diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-12-13 17:43:57 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-12-13 17:43:57 -0500 |
commit | 2d5ba0ebd7cc52a09724506b76c72fb0e89cccd0 (patch) | |
tree | 8ee6b60b3c4687a36b8d100403ad0a1ad569acd0 | |
parent | 586e8cbd97b4e2537f69ebe04b0c9d24fc090a4c (diff) | |
parent | 93222cf396192cc4e2d9a4dc741c60efda21404d (diff) | |
download | forums-2d5ba0ebd7cc52a09724506b76c72fb0e89cccd0.tar forums-2d5ba0ebd7cc52a09724506b76c72fb0e89cccd0.tar.gz forums-2d5ba0ebd7cc52a09724506b76c72fb0e89cccd0.tar.bz2 forums-2d5ba0ebd7cc52a09724506b76c72fb0e89cccd0.tar.xz forums-2d5ba0ebd7cc52a09724506b76c72fb0e89cccd0.zip |
Merge remote-tracking branch 'upstream/develop' into ticket/11015
* upstream/develop:
[ticket/11262] Add .lock in cache directory to .gitignore
[ticket/11265] Add assertions for board installation success.
[ticket/11263] Fix PHP Notice: Undefined variable: extension_manager
[ticket/10975] Add a test for viewing a profile.
[ticket/10975] Test restricting by first character.
[ticket/10975] Avoid rewriting global config twice.
[ticket/10975] Test memberlist, not user creation.
[ticket/10975] Some quick tests to check the memberlist behaviour
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 2 | ||||
-rw-r--r-- | tests/functional/memberlist_test.php | 43 | ||||
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 23 |
4 files changed, 58 insertions, 12 deletions
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 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; diff --git a/tests/functional/memberlist_test.php b/tests/functional/memberlist_test.php new file mode 100644 index 0000000000..879bee2f0e --- /dev/null +++ b/tests/functional/memberlist_test.php @@ -0,0 +1,43 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_memberlist_test extends phpbb_functional_test_case +{ + public function test_memberlist() + { + $this->create_user('memberlist-test-user'); + // logs in as admin + $this->login(); + $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()); + } + + 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()); + } +} diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 3bfbcd8c7b..db7fc4e6a3 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -202,12 +202,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'], 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"); } @@ -247,16 +255,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')) { @@ -272,7 +276,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(); |