From 6bfa2fc0551af7e4eb99c1452031a2f423611a6f Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sat, 13 Jul 2013 12:06:05 -0500 Subject: [ticket/11686] Not checking for phpBB Debug errors on functional tests PHPBB3-11686 --- tests/test_framework/phpbb_functional_test_case.php | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/test_framework/phpbb_functional_test_case.php') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 684d7a84cb..66af0db2b1 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -577,6 +577,7 @@ class phpbb_functional_test_case extends phpbb_test_case // Any output before the doc type means there was an error $content = self::$client->getResponse()->getContent(); + self::assertNotContains('[phpBB Debug]', $content); self::assertStringStartsWith(' Date: Fri, 6 Sep 2013 12:36:40 -0500 Subject: [ticket/11831] getAttribute was replaced with attr PHPBB3-11831 --- tests/test_framework/phpbb_functional_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_framework/phpbb_functional_test_case.php') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 1ced462c76..00b31212b2 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -661,7 +661,7 @@ class phpbb_functional_test_case extends phpbb_test_case $hidden_fields = array( $crawler->filter('[type="hidden"]')->each(function ($node, $i) { - return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); + return array('name' => $node->attr('name'), 'value' => $node->attr('value')); }), ); -- cgit v1.2.1 From ca92ed918a57605e969f0485b1ebca53806f0729 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 12 Mar 2014 19:09:29 +0100 Subject: [ticket/12176] Add newest_user_colour to config array to ensure it exists PHPBB3-12176 --- tests/test_framework/phpbb_functional_test_case.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/test_framework/phpbb_functional_test_case.php') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 00b31212b2..857112f29e 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -423,6 +423,13 @@ class phpbb_functional_test_case extends phpbb_test_case $config = array(); } + /* + * We need add some configs into the config array here, otherwise + * the set_config() function will try to add the value to the database, + * because some DBMS return 0 for sql_affectedrows() when a row was found, + * but not changed. + */ + $config['newest_user_colour'] = ''; $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; -- cgit v1.2.1 From e123b0c0a0791ac68b6099c2942eba8f6acbf56b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 13 Mar 2014 00:53:07 +0100 Subject: [ticket/12176] Reword comment about config entries. PHPBB3-12176 --- tests/test_framework/phpbb_functional_test_case.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/test_framework/phpbb_functional_test_case.php') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 857112f29e..5dfe07d380 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -424,10 +424,12 @@ class phpbb_functional_test_case extends phpbb_test_case } /* - * We need add some configs into the config array here, otherwise - * the set_config() function will try to add the value to the database, - * because some DBMS return 0 for sql_affectedrows() when a row was found, - * but not changed. + * Add required config entries to the config array to prevent + * set_config() sending an INSERT query for already existing entries, + * resulting in a SQL error. + * This is because set_config() first sends an UPDATE query, then checks + * sql_affectedrows() which can be 0 (e.g. on MySQL) when the new + * data is already there. */ $config['newest_user_colour'] = ''; $config['rand_seed'] = ''; -- cgit v1.2.1 From 9c8e843defef468cceba0d738d7b2dbf985901c6 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 29 May 2014 14:56:45 +0200 Subject: [ticket/11480] Add functionnal test PHPBB3-11480 --- .../test_framework/phpbb_functional_test_case.php | 67 +++++++++++++++++++--- 1 file changed, 59 insertions(+), 8 deletions(-) (limited to 'tests/test_framework/phpbb_functional_test_case.php') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 5dfe07d380..c71cd4d0a9 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -665,6 +665,64 @@ class phpbb_functional_test_case extends phpbb_test_case { $this->add_lang('posting'); + $crawler = $this->submit_message($posting_url, $posting_contains, $form_data); + + $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text()); + $url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri(); + + return array( + 'topic_id' => $this->get_parameter_from_link($url, 't'), + 'post_id' => $this->get_parameter_from_link($url, 'p'), + ); + } + + /** + * Creates a private message + * + * Be sure to login before creating + * + * @param string $subject + * @param string $message + * @param array $to + * @param array $additional_form_data Any additional form data to be sent in the request + * @return int private_message_id + */ + public function create_private_message($subject, $message, $to, $additional_form_data = array()) + { + $this->add_lang(array('ucp', 'posting')); + + $posting_url = "ucp.php?i=pm&mode=compose&sid={$this->sid}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + foreach ($to as $user_id) + { + $form_data['address_list[u][' . $user_id . ']'] = 'to'; + } + + $crawler = self::submit_message($posting_url, 'POST_NEW_PM', $form_data); + + $this->assertContains($this->lang('MESSAGE_STORED'), $crawler->filter('html')->text()); + $url = $crawler->selectLink($this->lang('VIEW_PRIVATE_MESSAGE', '', ''))->link()->getUri(); + + return $this->get_parameter_from_link($url, 'p'); + } + + /** + * Helper for submitting a message (post or private message) + * + * @param string $posting_url + * @param string $posting_contains + * @param array $form_data + * @return \Symfony\Component\DomCrawler\Crawler the crawler object + */ + protected function submit_message($posting_url, $posting_contains, $form_data) + { + $crawler = self::request('GET', $posting_url); $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text()); @@ -689,14 +747,7 @@ class phpbb_functional_test_case extends phpbb_test_case // I use a request because the form submission method does not allow you to send data that is not // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) // Instead, I send it as a request with the submit button "post" set to true. - $crawler = self::request('POST', $posting_url, $form_data); - $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text()); - $url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri(); - - return array( - 'topic_id' => $this->get_parameter_from_link($url, 't'), - 'post_id' => $this->get_parameter_from_link($url, 'p'), - ); + return self::request('POST', $posting_url, $form_data); } /** -- cgit v1.2.1 From 0ce27eacb1e0ca797cb8722fc3e57fd3ae7bc85f Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 30 Jun 2014 00:33:33 +0200 Subject: [ticket/11480] Fix the double spaces in phpbb_functional_test_case PHPBB3-11480 --- tests/test_framework/phpbb_functional_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_framework/phpbb_functional_test_case.php') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index c71cd4d0a9..4522674649 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -747,7 +747,7 @@ class phpbb_functional_test_case extends phpbb_test_case // I use a request because the form submission method does not allow you to send data that is not // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) // Instead, I send it as a request with the submit button "post" set to true. - return self::request('POST', $posting_url, $form_data); + return self::request('POST', $posting_url, $form_data); } /** -- cgit v1.2.1 From ed2d08055139bfebc67f01e6d4eda8b03ac7d9e8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 25 Jan 2015 23:06:56 +0100 Subject: [ticket/12089] Add assert message on HTTP status code check PHPBB3-12089 --- tests/test_framework/phpbb_functional_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_framework/phpbb_functional_test_case.php') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 4522674649..9b64600c7d 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -601,7 +601,7 @@ class phpbb_functional_test_case extends phpbb_test_case */ static public function assert_response_status_code($status_code = 200) { - self::assertEquals($status_code, self::$client->getResponse()->getStatus()); + self::assertEquals($status_code, self::$client->getResponse()->getStatus(), 'HTTP status code does not match'); } /** -- cgit v1.2.1