diff options
author | Andreas Fischer <bantu@phpbb.com> | 2012-12-13 15:56:08 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2012-12-13 15:56:08 +0100 |
commit | 86e4a3ddfdfc2514076d3b075d4b34c6b106126b (patch) | |
tree | a76319983dbf168f04654bd6c9d199a760a0acc7 | |
parent | 0916dc14efaa36073cdc9783401b818ecc0716cc (diff) | |
parent | 326b6eb8572101d53eece1dd8df288460be27650 (diff) | |
download | forums-86e4a3ddfdfc2514076d3b075d4b34c6b106126b.tar forums-86e4a3ddfdfc2514076d3b075d4b34c6b106126b.tar.gz forums-86e4a3ddfdfc2514076d3b075d4b34c6b106126b.tar.bz2 forums-86e4a3ddfdfc2514076d3b075d4b34c6b106126b.tar.xz forums-86e4a3ddfdfc2514076d3b075d4b34c6b106126b.zip |
Merge remote-tracking branch 'p/ticket/10975' into develop
* p/ticket/10975:
[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-- | tests/functional/memberlist_test.php | 43 | ||||
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 9 |
2 files changed, 45 insertions, 7 deletions
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 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(); |