diff options
author | Tristan Darricau <github@nicofuma.fr> | 2016-11-06 15:41:46 +0100 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2016-11-06 15:41:46 +0100 |
commit | dc32b900c58943df25ae5085c96ad47fc6e67c61 (patch) | |
tree | 0ce695ad61d406543031ce7b03ec52ab1af10a3d /tests/functional | |
parent | 85898d3d2c7b5ce61a0f92299e06ceade000c4a8 (diff) | |
parent | ac36cc25ebb4b7ee26228607dd3e171641dea8bd (diff) | |
download | forums-dc32b900c58943df25ae5085c96ad47fc6e67c61.tar forums-dc32b900c58943df25ae5085c96ad47fc6e67c61.tar.gz forums-dc32b900c58943df25ae5085c96ad47fc6e67c61.tar.bz2 forums-dc32b900c58943df25ae5085c96ad47fc6e67c61.tar.xz forums-dc32b900c58943df25ae5085c96ad47fc6e67c61.zip |
Merge pull request #4486 from marc1706/ticket/11483
[ticket/11483] Generate user act key if database entry is empty
* github.com:phpbb/phpbb:
[ticket/11483] Add tests for generating user act key on force reactivate
[ticket/11483] Generate user act key if database entry is empty
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/user_password_reset_test.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/functional/user_password_reset_test.php b/tests/functional/user_password_reset_test.php index f9406f0eb5..3da78407cf 100644 --- a/tests/functional/user_password_reset_test.php +++ b/tests/functional/user_password_reset_test.php @@ -113,6 +113,49 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca $this->assertContains($this->lang('LOGIN_ERROR_PASSWORD', '', ''), $crawler->filter('html')->text()); } + /** + * @depends test_login + */ + public function test_acivateAfterDeactivate() + { + // User is active, actkey should not exist + $this->get_user_data(); + $this->assertEmpty($this->user_data['user_actkey']); + + $this->login(); + $this->admin_login(); + $this->add_lang('acp/users'); + + // Go to user account page + $crawler = self::request('GET', 'adm/index.php?i=acp_users&mode=overview&sid=' . $this->sid); + $this->assertContainsLang('FIND_USERNAME', $crawler->filter('html')->text()); + + $form = $crawler->selectButton('Submit')->form(); + $crawler = self::submit($form, array('username' => 'reset-password-test-user')); + + // Deactivate account and go back to overview of current user + $this->assertContainsLang('USER_TOOLS', $crawler->filter('html')->text()); + $form = $crawler->filter('input[name=update]')->selectButton('Submit')->form(); + $crawler = self::submit($form, array('action' => 'active')); + + $this->assertContainsLang('USER_ADMIN_DEACTIVED', $crawler->filter('html')->text()); + $link = $crawler->selectLink('Back to previous page')->link(); + $crawler = self::request('GET', preg_replace('#(.+)(adm/index.php.+)#', '$2', $link->getUri())); + + // Ensure again that actkey is empty after deactivation + $this->get_user_data(); + $this->assertEmpty($this->user_data['user_actkey']); + + // Force reactivation of account and check that act key is not empty anymore + $this->assertContainsLang('USER_TOOLS', $crawler->filter('html')->text()); + $form = $crawler->filter('input[name=update]')->selectButton('Submit')->form(); + $crawler = self::submit($form, array('action' => 'reactivate')); + $this->assertContainsLang('FORCE_REACTIVATION_SUCCESS', $crawler->filter('html')->text()); + + $this->get_user_data(); + $this->assertNotEmpty($this->user_data['user_actkey']); + } + protected function get_user_data() { $db = $this->get_db(); |