From 2d5bd24fded901fd7efdcd043916ec374f0f76c1 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Mon, 9 Jul 2012 00:30:01 +0100 Subject: [PATCH 1/8] [ticket/10975] Some quick tests to check the memberlist behaviour Checks behaviour when adding and deleting a user. PHPBB3-10975 --- tests/functional/memberlist_test.php | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/functional/memberlist_test.php diff --git a/tests/functional/memberlist_test.php b/tests/functional/memberlist_test.php new file mode 100644 index 0000000000..f7cc510caf --- /dev/null +++ b/tests/functional/memberlist_test.php @@ -0,0 +1,33 @@ +create_user('user'); + $this->login(); + $crawler = $this->request('GET', 'memberlist.php?sid=' . $this->sid); + $this->assertContains('user', $crawler->filter('#memberlist tr')->eq(1)->text()); + } + + /** + * @depends test_create_user + */ + public function test_delete_user() + { + $this->delete_user('user'); + $this->login(); + $crawler = $this->request('GET', 'memberlist.php?sid=' . $this->sid); + $this->assertEquals(2, $crawler->filter('#memberlist tr')->count()); + } +} From c5f350906d0470e54ca7ade935b4bee841acdbed Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 13 Dec 2012 07:27:40 -0500 Subject: [PATCH 2/8] [ticket/10975] Test memberlist, not user creation. PHPBB3-10975 --- tests/functional/memberlist_test.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/tests/functional/memberlist_test.php b/tests/functional/memberlist_test.php index f7cc510caf..fd80f9b031 100644 --- a/tests/functional/memberlist_test.php +++ b/tests/functional/memberlist_test.php @@ -12,22 +12,13 @@ */ class phpbb_functional_memberlist_test extends phpbb_functional_test_case { - public function test_create_user() + public function test_view() { - $this->create_user('user'); + $this->create_user('memberlist-test-user'); + // logs in as admin $this->login(); $crawler = $this->request('GET', 'memberlist.php?sid=' . $this->sid); - $this->assertContains('user', $crawler->filter('#memberlist tr')->eq(1)->text()); - } - - /** - * @depends test_create_user - */ - public function test_delete_user() - { - $this->delete_user('user'); - $this->login(); - $crawler = $this->request('GET', 'memberlist.php?sid=' . $this->sid); - $this->assertEquals(2, $crawler->filter('#memberlist tr')->count()); + $this->assert_response_success(); + $this->assertContains('memberlist-test-user', $crawler->text()); } } From 4de07338efcd4f0d390df0f2d7fa883712d8c942 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 13 Dec 2012 07:28:01 -0500 Subject: [PATCH 3/8] [ticket/10975] Avoid rewriting global config twice. PHPBB3-10975 --- tests/test_framework/phpbb_functional_test_case.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 9097854bd4..b6f8e5c44c 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -251,16 +251,12 @@ class phpbb_functional_test_case extends phpbb_test_case // Required by unique_id global $config; - if (!is_array($config)) - { - $config = array(); - } - + $config = new phpbb_config(array()); $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; // Required by user_add - global $db, $cache, $config, $phpbb_dispatcher; + global $db, $cache, $phpbb_dispatcher; $db = $this->get_db(); if (!function_exists('phpbb_mock_null_cache')) { @@ -276,7 +272,6 @@ class phpbb_functional_test_case extends phpbb_test_case { require_once(__DIR__ . '/../../phpBB/includes/functions_user.php'); } - $config = new phpbb_config(array()); set_config(null, null, null, $config); set_config_count(null, null, null, $config); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); From b42a2283129a936ce0095394f68e43faa1e8052a Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 13 Dec 2012 07:33:02 -0500 Subject: [PATCH 4/8] [ticket/10975] Test restricting by first character. PHPBB3-10975 --- tests/functional/memberlist_test.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/functional/memberlist_test.php b/tests/functional/memberlist_test.php index fd80f9b031..b3cb7db759 100644 --- a/tests/functional/memberlist_test.php +++ b/tests/functional/memberlist_test.php @@ -20,5 +20,15 @@ class phpbb_functional_memberlist_test extends phpbb_functional_test_case $crawler = $this->request('GET', 'memberlist.php?sid=' . $this->sid); $this->assert_response_success(); $this->assertContains('memberlist-test-user', $crawler->text()); + + // restrict by first character + $crawler = $this->request('GET', 'memberlist.php?first_char=m&sid=' . $this->sid); + $this->assert_response_success(); + $this->assertContains('memberlist-test-user', $crawler->text()); + + // make sure results for wrong character are not returned + $crawler = $this->request('GET', 'memberlist.php?first_char=a&sid=' . $this->sid); + $this->assert_response_success(); + $this->assertNotContains('memberlist-test-user', $crawler->text()); } } From 326b6eb8572101d53eece1dd8df288460be27650 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 13 Dec 2012 07:41:24 -0500 Subject: [PATCH 5/8] [ticket/10975] Add a test for viewing a profile. PHPBB3-10975 --- tests/functional/memberlist_test.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/functional/memberlist_test.php b/tests/functional/memberlist_test.php index b3cb7db759..879bee2f0e 100644 --- a/tests/functional/memberlist_test.php +++ b/tests/functional/memberlist_test.php @@ -12,7 +12,7 @@ */ class phpbb_functional_memberlist_test extends phpbb_functional_test_case { - public function test_view() + public function test_memberlist() { $this->create_user('memberlist-test-user'); // logs in as admin @@ -31,4 +31,13 @@ class phpbb_functional_memberlist_test extends phpbb_functional_test_case $this->assert_response_success(); $this->assertNotContains('memberlist-test-user', $crawler->text()); } + + public function test_viewprofile() + { + $this->login(); + // XXX hardcoded user id + $crawler = $this->request('GET', 'memberlist.php?mode=viewprofile&u=2&sid=' . $this->sid); + $this->assert_response_success(); + $this->assertContains('admin', $crawler->filter('h2')->text()); + } } From ec074eb97c2b2dc490089782420b065f4c1274cb Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 13:10:26 -0600 Subject: [PATCH 6/8] [ticket/11263] Fix PHP Notice: Undefined variable: extension_manager $extension_manager should be $phpbb_extension_manager PHPBB3-11263 --- phpBB/includes/functions_messenger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index a33d7f0aa3..d0a02567ad 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -210,7 +210,7 @@ class messenger { $style_resource_locator = new phpbb_style_resource_locator(); $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider()); - $tpl = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $extension_manager); + $tpl = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager); $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl); $this->tpl_msg[$template_lang . $template_file] = $tpl; From 789c04b90025cf230b3b965ece8022104128c92c Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 13 Dec 2012 15:42:00 -0500 Subject: [PATCH 7/8] [ticket/11265] Add assertions for board installation success. PHPBB3-11265 --- .../test_framework/phpbb_functional_test_case.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 93a4ab2fbf..8ab6469e9a 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -183,12 +183,20 @@ class phpbb_functional_test_case extends phpbb_test_case self::assertNotSame(false, $content); self::assertContains('Welcome to Installation', $content); - self::do_request('create_table', $data); + $content = self::do_request('create_table', $data); + self::assertNotSame(false, $content); + self::assertContains('The database tables used by phpBB', $content); + // 3.0 or 3.1 + self::assertContains('have been created and populated with some initial data.', $content); - self::do_request('config_file', $data); + $content = self::do_request('config_file', $data); + self::assertNotSame(false, $content); + self::assertContains('Configuration file', $content); file_put_contents($phpbb_root_path . "config.$phpEx", phpbb_create_config_file_data($data, self::$config['dbms'], array(), true, true)); - self::do_request('final', $data); + $content = self::do_request('final', $data); + self::assertNotSame(false, $content); + self::assertContains('You have successfully installed', $content); copy($phpbb_root_path . "config.$phpEx", $phpbb_root_path . "config_test.$phpEx"); } From 845bf6a6384b758c78229738db69845604f02437 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 12:56:09 -0600 Subject: [PATCH 8/8] [ticket/11262] Add .lock in cache directory to .gitignore PHPBB3-11262 --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4093aeb56d..c757210654 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ /phpunit.xml /phpBB/cache/*.html /phpBB/cache/*.php -/phpBB/cache/queue.php.lock +/phpBB/cache/*.lock /phpBB/composer.phar /phpBB/config.php /phpBB/config_dev.php