From 217fc07036ea3e4addb10d35994ac8f1a440ac25 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 31 Jul 2021 08:32:41 +0200 Subject: [PATCH] [ticket/16825] Adjust functional tests for modified sid handling PHPBB3-16825 --- tests/functional/auth_test.php | 7 +------ tests/functional/mcp_test.php | 12 +++--------- tests/functional/report_post_captcha_test.php | 4 ++-- tests/functional/ucp_profile_test.php | 5 ++++- tests/test_framework/phpbb_functional_test_case.php | 7 +++++-- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/tests/functional/auth_test.php b/tests/functional/auth_test.php index 23807c43dc..a0c96b21ea 100644 --- a/tests/functional/auth_test.php +++ b/tests/functional/auth_test.php @@ -60,12 +60,7 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case $this->login(); $this->add_lang('ucp'); - // logout - $crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout'); - - // look for a register link, which should be visible only when logged out - $crawler = self::request('GET', 'index.php'); - $this->assertStringContainsString($this->lang('REGISTER'), $crawler->filter('.navbar')->text()); + $this->logout(); } public function test_acp_login() diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php index a9ba2f3a83..11b877be20 100644 --- a/tests/functional/mcp_test.php +++ b/tests/functional/mcp_test.php @@ -46,6 +46,7 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case public function test_move_post_to_topic($crawler) { $this->login(); + $this->add_lang('mcp'); // Select the post in MCP $form = $crawler->selectButton($this->lang('SUBMIT'))->form(array( @@ -55,18 +56,11 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case $crawler = self::submit($form); $this->assertStringContainsString($this->lang('MERGE_POSTS'), $crawler->filter('html')->text()); - return $crawler; - } - - /** - * @depends test_move_post_to_topic - */ - public function test_confirm_result($crawler) - { - $this->add_lang('mcp'); $form = $crawler->selectButton('Yes')->form(); $crawler = self::submit($form); $this->assertStringContainsString($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text()); + + return $crawler; } public function test_delete_logs() diff --git a/tests/functional/report_post_captcha_test.php b/tests/functional/report_post_captcha_test.php index e4c2ff6ab7..1c7435fcf3 100644 --- a/tests/functional/report_post_captcha_test.php +++ b/tests/functional/report_post_captcha_test.php @@ -64,8 +64,8 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca $values = $form->getValues(); $values["setting[1][2][f_report]"] = $report_post_allowed; $form->setValues($values); - $crawler = self::submit($form); + self::submit($form); - $crawler = self::request('GET', 'ucp.php?mode=logout&sid=' . $this->sid); + $this->logout(); } } diff --git a/tests/functional/ucp_profile_test.php b/tests/functional/ucp_profile_test.php index 18839a5a68..311a30d56b 100644 --- a/tests/functional/ucp_profile_test.php +++ b/tests/functional/ucp_profile_test.php @@ -89,7 +89,10 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case $this->assertStringContainsString($key_id, $crawler->filter('label[for="' . $key_id . '"]')->text()); $form = $crawler->selectButton('submit')->form(); - $form['keys'][0]->tick(); + foreach ($form['keys'] as $key) + { + $key->tick(); + } $crawler = self::submit($form); $this->assertStringContainsString($this->lang('AUTOLOGIN_SESSION_KEYS_DELETED'), $crawler->filter('html')->text()); diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 600fbe60be..8d48821f47 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -829,10 +829,13 @@ class phpbb_functional_test_case extends phpbb_test_case { $this->add_lang('ucp'); - $crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout'); + $crawler = self::request('GET', 'index.php'); + $logout_link = $crawler->filter('a[title="' . $this->lang('LOGOUT') . '"]')->attr('href'); + self::request('GET', $logout_link); + + $crawler = self::request('GET', $logout_link); $this->assertStringContainsString($this->lang('REGISTER'), $crawler->filter('.navbar')->text()); unset($this->sid); - } /**