Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 59 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functional_ucp_profile_test | |
0.00% |
0 / 59 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| test_submitting_profile_info | |
0.00% |
0 / 24 |
|
0.00% |
0 / 1 |
2 | |||
| test_submitting_emoji | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
2 | |||
| test_autologin_keys_manage | |
0.00% |
0 / 23 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | /** |
| 15 | * @group functional |
| 16 | */ |
| 17 | class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case |
| 18 | { |
| 19 | public function test_submitting_profile_info() |
| 20 | { |
| 21 | $this->add_lang('ucp'); |
| 22 | $this->add_lang('memberlist'); |
| 23 | $this->login(); |
| 24 | |
| 25 | $crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info'); |
| 26 | $this->assertContainsLang('UCP_PROFILE_PROFILE_INFO', $crawler->filter('#cp-main h2')->text()); |
| 27 | |
| 28 | $form = $crawler->selectButton('Submit')->form(array( |
| 29 | 'pf_phpbb_facebook' => 'phpbb', |
| 30 | 'pf_phpbb_location' => 'Bertie´s Empire', |
| 31 | 'pf_phpbb_skype' => 'phpbb.skype.account', |
| 32 | 'pf_phpbb_twitter' => 'phpbb_twitter', |
| 33 | 'pf_phpbb_youtube' => 'user/phpbb.youtube', |
| 34 | )); |
| 35 | |
| 36 | $crawler = self::submit($form); |
| 37 | $this->assertContainsLang('PROFILE_UPDATED', $crawler->filter('#message')->text()); |
| 38 | |
| 39 | $crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info'); |
| 40 | $form = $crawler->selectButton('Submit')->form(); |
| 41 | |
| 42 | $this->assertEquals('phpbb', $form->get('pf_phpbb_facebook')->getValue()); |
| 43 | $this->assertEquals('Bertie´s Empire', $form->get('pf_phpbb_location')->getValue()); |
| 44 | $this->assertEquals('phpbb.skype.account', $form->get('pf_phpbb_skype')->getValue()); |
| 45 | $this->assertEquals('phpbb_twitter', $form->get('pf_phpbb_twitter')->getValue()); |
| 46 | $this->assertEquals('user/phpbb.youtube', $form->get('pf_phpbb_youtube')->getValue()); |
| 47 | |
| 48 | $crawler = self::request('GET', 'memberlist.php?mode=viewprofile&un=admin'); |
| 49 | $link = $crawler->selectLink($this->lang('VIEW_YOUTUBE_PROFILE')); |
| 50 | $this->assertSame('https://youtube.com/user/phpbb.youtube', $link->attr('href')); |
| 51 | } |
| 52 | |
| 53 | public function test_submitting_emoji() |
| 54 | { |
| 55 | $this->add_lang('ucp'); |
| 56 | $this->login(); |
| 57 | |
| 58 | $crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info'); |
| 59 | $this->assertContainsLang('UCP_PROFILE_PROFILE_INFO', $crawler->filter('#cp-main h2')->text()); |
| 60 | |
| 61 | $form = $crawler->selectButton('Submit')->form([ |
| 62 | 'pf_phpbb_location' => '😁', // grinning face with smiling eyes Emoji |
| 63 | ]); |
| 64 | $crawler = self::submit($form); |
| 65 | $this->assertContainsLang('PROFILE_UPDATED', $crawler->filter('#message')->text()); |
| 66 | |
| 67 | $crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info'); |
| 68 | $form = $crawler->selectButton('Submit')->form(); |
| 69 | $this->assertEquals('😁', $form->get('pf_phpbb_location')->getValue()); |
| 70 | } |
| 71 | |
| 72 | public function test_autologin_keys_manage() |
| 73 | { |
| 74 | $this->add_lang('ucp'); |
| 75 | $this->login('admin', true); |
| 76 | |
| 77 | $crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=autologin_keys'); |
| 78 | $this->assertContainsLang('UCP_PROFILE_AUTOLOGIN_KEYS', $crawler->filter('#cp-main h2')->text()); |
| 79 | |
| 80 | $profile_url = $crawler->filter('a[title="Profile"]')->attr('href'); |
| 81 | $user_id = $this->get_parameter_from_link($profile_url, 'u'); |
| 82 | |
| 83 | $sql_ary = [ |
| 84 | 'SELECT' => 'sk.key_id', |
| 85 | 'FROM' => [SESSIONS_KEYS_TABLE => 'sk'], |
| 86 | 'WHERE' => 'sk.user_id = ' . (int) $user_id, |
| 87 | 'ORDER_BY' => 'sk.last_login ASC', |
| 88 | ]; |
| 89 | $result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_ary), 1); |
| 90 | $key_id = substr($this->db->sql_fetchfield('key_id'), 0, 8); |
| 91 | $this->db->sql_freeresult($result); |
| 92 | |
| 93 | $this->assertStringContainsString($key_id, $crawler->filter('label[for="' . $key_id . '"]')->text()); |
| 94 | |
| 95 | $form = $crawler->selectButton('submit')->form(); |
| 96 | foreach ($form['keys'] as $key) |
| 97 | { |
| 98 | $key->tick(); |
| 99 | } |
| 100 | $crawler = self::submit($form); |
| 101 | $this->assertStringContainsString($this->lang('AUTOLOGIN_SESSION_KEYS_DELETED'), $crawler->filter('html')->text()); |
| 102 | |
| 103 | $crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=autologin_keys'); |
| 104 | $this->assertStringContainsString($this->lang('PROFILE_NO_AUTOLOGIN_KEYS'), $crawler->filter('tbody > tr > td[class="bg1"]')->text()); |
| 105 | } |
| 106 | } |