Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 96 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functional_registration_test | |
0.00% |
0 / 96 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| test_disable_captcha_on_registration | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
| test_register_new_account | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
2 | |||
| test_default_subscription_options | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| test_register_coppa_account | |
0.00% |
0 / 31 |
|
0.00% |
0 / 1 |
2 | |||
| test_register_new_account_with_cpf_numbers | |
0.00% |
0 / 37 |
|
0.00% |
0 / 1 |
2 | |||
| 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_registration_test extends phpbb_functional_test_case |
| 18 | { |
| 19 | public function test_disable_captcha_on_registration() |
| 20 | { |
| 21 | $this->login(); |
| 22 | $this->admin_login(); |
| 23 | |
| 24 | $crawler = self::request('GET', "adm/index.php?i=acp_board&mode=registration&sid={$this->sid}"); |
| 25 | $form = $crawler->selectButton('Submit')->form(); |
| 26 | $form['config[enable_confirm]']->setValue('0'); |
| 27 | $form['config[pass_complex]']->setValue('PASS_TYPE_ANY'); |
| 28 | $crawler = self::submit($form); |
| 29 | |
| 30 | $this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('#main .successbox')->text()); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * @depends test_disable_captcha_on_registration |
| 35 | */ |
| 36 | public function test_register_new_account() |
| 37 | { |
| 38 | $this->add_lang('ucp'); |
| 39 | |
| 40 | // Check that we can't skip |
| 41 | self::request('GET', 'ucp.php?mode=register&agreed=1'); |
| 42 | $this->assertContainsLang('AGREE', $this->get_content()); |
| 43 | |
| 44 | $crawler = self::request('GET', 'ucp.php?mode=register'); |
| 45 | $this->assertContainsLang('REGISTRATION', $crawler->filter('div.content h2')->text()); |
| 46 | |
| 47 | $form = $crawler->selectButton('I agree to these terms')->form(); |
| 48 | $crawler = self::submit($form); |
| 49 | |
| 50 | $form = $crawler->selectButton('Submit')->form(array( |
| 51 | 'username' => 'user-reg-test', |
| 52 | 'email' => 'user-reg-test@phpbb.com', |
| 53 | 'new_password' => 'user-reg-testuser-reg-test', |
| 54 | 'password_confirm' => 'user-reg-testuser-reg-test', |
| 55 | )); |
| 56 | $form['tz']->select('Europe/Berlin'); |
| 57 | $crawler = self::submit($form); |
| 58 | |
| 59 | $this->assertContainsLang('ACCOUNT_ADDED', $crawler->filter('#message')->text()); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @depends test_register_new_account |
| 64 | */ |
| 65 | public function test_default_subscription_options() |
| 66 | { |
| 67 | $this->login('user-reg-test'); |
| 68 | $crawler = self::request('GET', 'ucp.php?i=ucp_notifications&mode=notification_options&sid=' . $this->sid); |
| 69 | $this->assert_checkbox_is_checked($crawler, 'notification.type.post_notification.method.email'); |
| 70 | $this->assert_checkbox_is_checked($crawler, 'notification.type.topic_notification.method.email'); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @depends test_disable_captcha_on_registration |
| 75 | */ |
| 76 | public function test_register_coppa_account() |
| 77 | { |
| 78 | $this->login(); |
| 79 | $this->admin_login(); |
| 80 | |
| 81 | $crawler = self::request('GET', "adm/index.php?i=acp_board&mode=registration&sid={$this->sid}"); |
| 82 | $form = $crawler->selectButton('Submit')->form(); |
| 83 | $form['config[coppa_enable]']->setValue('1'); |
| 84 | $crawler = self::submit($form); |
| 85 | |
| 86 | $this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('#main .successbox')->text()); |
| 87 | $this->logout(); |
| 88 | |
| 89 | $this->add_lang('ucp'); |
| 90 | |
| 91 | // Check that we can't skip |
| 92 | $crawler = self::request('GET', 'ucp.php?mode=register&coppa=1'); |
| 93 | $this->assertContainsLang('COPPA_BIRTHDAY', $crawler->html()); |
| 94 | |
| 95 | $form = $crawler->selectButton('coppa_yes')->form(); |
| 96 | $crawler = self::submit($form); |
| 97 | |
| 98 | $this->assertContainsLang('REGISTRATION', $crawler->filter('div.content h2')->text()); |
| 99 | |
| 100 | $form = $crawler->selectButton('I agree to these terms')->form(); |
| 101 | $crawler = self::submit($form); |
| 102 | |
| 103 | $form = $crawler->selectButton('Submit')->form(array( |
| 104 | 'username' => 'user-coppa-test', |
| 105 | 'email' => 'user-coppa-test@phpbb.com', |
| 106 | 'new_password' => 'user-coppa-testuser-coppa-test', |
| 107 | 'password_confirm' => 'user-coppa-testuser-coppa-test', |
| 108 | )); |
| 109 | $form['tz']->select('Europe/Berlin'); |
| 110 | $crawler = self::submit($form); |
| 111 | |
| 112 | $this->assertContainsLang('ACCOUNT_COPPA', $crawler->filter('#message')->text()); |
| 113 | |
| 114 | $this->login(); |
| 115 | $this->admin_login(); |
| 116 | |
| 117 | $crawler = self::request('GET', "adm/index.php?i=acp_board&mode=registration&sid={$this->sid}"); |
| 118 | $form = $crawler->selectButton('Submit')->form(); |
| 119 | $form['config[coppa_enable]']->setValue('0'); |
| 120 | $crawler = self::submit($form); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * @depends test_disable_captcha_on_registration |
| 125 | */ |
| 126 | public function test_register_new_account_with_cpf_numbers() |
| 127 | { |
| 128 | $this->add_lang(['ucp', 'acp/profile']); |
| 129 | |
| 130 | // Create "Numbers" type CPF but don't set its default value |
| 131 | $this->login(); |
| 132 | $this->admin_login(); |
| 133 | |
| 134 | $crawler = self::request('GET', "adm/index.php?i=acp_profile&mode=profile&sid={$this->sid}"); |
| 135 | $form = $crawler->selectButton('submit')->form([ // Create new field |
| 136 | 'field_type' => 'profilefields.type.int', |
| 137 | ]); |
| 138 | $crawler = self::submit($form); |
| 139 | |
| 140 | $this->assertContainsLang('STEP_1_TITLE_CREATE', $this->get_content()); |
| 141 | $this->assertStringContainsString('Numbers', $crawler->filter('dl > dd > strong')->text()); |
| 142 | |
| 143 | $form = $crawler->selectButton('next')->form([ // Go to Profile type specific options |
| 144 | 'field_ident' => 'Numbers', |
| 145 | 'lang_name' => 'Numbers CPF', |
| 146 | ]); |
| 147 | $form['field_show_on_reg']->tick(); |
| 148 | $crawler = self::submit($form); |
| 149 | |
| 150 | $this->assertContainsLang('STEP_2_TITLE_CREATE', $this->get_content()); |
| 151 | |
| 152 | $form = $crawler->selectButton('Save')->form(); // Save CPF |
| 153 | self::submit($form); |
| 154 | $this->assertContainsLang('ADDED_PROFILE_FIELD', $this->get_content()); |
| 155 | |
| 156 | $this->logout(); |
| 157 | |
| 158 | // Get into registration process |
| 159 | // Check that we can't skip |
| 160 | self::request('GET', 'ucp.php?mode=register&agreed=1'); |
| 161 | $this->assertContainsLang('AGREE', $this->get_content()); |
| 162 | |
| 163 | $crawler = self::request('GET', 'ucp.php?mode=register'); |
| 164 | $this->assertContainsLang('REGISTRATION', $crawler->filter('div.content h2')->text()); |
| 165 | |
| 166 | $form = $crawler->selectButton('I agree to these terms')->form(); |
| 167 | $crawler = self::submit($form); |
| 168 | |
| 169 | // Check if Numbers CPF displayed on registration |
| 170 | $this->assertStringContainsString('Numbers CPF', $crawler->filter('label[for="pf_numbers"]')->text()); |
| 171 | |
| 172 | $form = $crawler->selectButton('Submit')->form(array( |
| 173 | 'username' => 'user-reg-test1', |
| 174 | 'email' => 'user-reg-test1@phpbb.com', |
| 175 | 'new_password' => 'user-reg-testuser-reg-test1', |
| 176 | 'password_confirm' => 'user-reg-testuser-reg-test1', |
| 177 | )); |
| 178 | $form['tz']->select('Europe/Berlin'); |
| 179 | $crawler = self::submit($form); |
| 180 | |
| 181 | $this->assertContainsLang('ACCOUNT_ADDED', $crawler->filter('#message')->text()); |
| 182 | } |
| 183 | } |