From 9d4d212e0f71789e1f0332046dd852d80ab9c8ba Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 24 Oct 2013 13:55:23 +0200 Subject: [ticket/11525] Only remove group or user prefix from given avatar data Until now, the user data had both user_id and group_id keys in the avatar data. As both group_ and user_ prefixes were removed the group_id was collapsed onto the user_id and therefore all users in the same group had the same prefix for their uploaded avatars. This patch will make sure that the correct id is used depending on whether it's a group's or user's avatar data. PHPBB3-11525 --- tests/avatar/manager_test.php | 44 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 4afa594beb..f687f7bc86 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -201,20 +201,58 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase 'foobar_avatar_height' => '', ), ), + array( + array( + 'user_avatar' => '', + 'user_id' => 5, + 'group_id' => 4, + ), + array( + 'avatar' => '', + 'id' => 4, + ), + ), + array( + array( + 'user_avatar' => '', + 'user_id' => 5, + 'group_id' => 4, + ), + array( + 'avatar' => '', + 'id' => 5, + 'group_id' => 4, + ), + 'user', + ), + array( + array( + 'group_avatar' => '', + 'user_id' => 5, + 'group_id' => 4, + ), + array( + 'avatar' => '', + 'id' => 4, + 'user_id' => 5, + ), + 'group', + ), ); } /** * @dataProvider database_row_data */ - public function test_clean_row(array $input, array $output) + public function test_clean_row(array $input, array $output, $prefix = '') { $cleaned_row = array(); - $cleaned_row = \phpbb\avatar\manager::clean_row($input); - foreach ($output as $key => $null) + $cleaned_row = \phpbb\avatar\manager::clean_row($input, $prefix); + foreach ($output as $key => $value) { $this->assertArrayHasKey($key, $cleaned_row); + $this->assertEquals($output[$key], $value); } } -- cgit v1.2.1 From 9b0b5481fe05b10a254861495280d04721e8d9d1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 24 Oct 2013 21:03:06 +0200 Subject: [ticket/11534] Check remote avatar content type if possible This should make sure that error pages like 404 or 503 pages are not treated as remote avatar images. PHPBB3-11534 --- tests/functional/avatar_acp_groups_test.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php index 9fdc29cc76..5e908bc6da 100644 --- a/tests/functional/avatar_acp_groups_test.php +++ b/tests/functional/avatar_acp_groups_test.php @@ -50,6 +50,15 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av 'avatar_delete' => array('tick', ''), ), ), + array( + 'The URL you specified is invalid.', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), ); } -- cgit v1.2.1 From b2f638b79359ee6df600ca940ffa2b1657235364 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 27 Oct 2013 09:52:09 +0100 Subject: [ticket/11857] Use passed service collection instead of container in manager The service collection that was already passed to the avatar manager should be used in the avatar manager method get_driver() instead of the container itself. PHPBB3-11857 --- tests/avatar/manager_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 4afa594beb..0db3f13617 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -112,7 +112,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase public function test_get_driver_enabled($driver_name, $expected) { $driver = $this->manager->get_driver($driver_name); - $this->assertEquals($expected, $driver); + $this->assertEquals($expected, ($driver === null) ? null : $driver->get_name()); } public function get_driver_data_all() @@ -133,7 +133,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase public function test_get_driver_all($driver_name, $expected) { $driver = $this->manager->get_driver($driver_name, false); - $this->assertEquals($expected, $driver); + $this->assertEquals($expected, ($driver === null) ? $driver : $driver->get_name()); } public function test_get_avatar_settings() -- cgit v1.2.1 From a175b091b9066478900d4a1a92c3e67f33cd9b33 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 2 Nov 2013 18:12:50 +0100 Subject: [ticket/11995] Add unit test for reverting config.remove PHPBB3-11995 --- tests/dbal/migrator_tool_config_test.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php index a8d8966839..d007e36da1 100644 --- a/tests/dbal/migrator_tool_config_test.php +++ b/tests/dbal/migrator_tool_config_test.php @@ -94,6 +94,7 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case public function test_reverse() { + // add $this->config->set('foo', 'bar'); try @@ -106,6 +107,21 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case } $this->assertFalse(isset($this->config['foo'])); + // remove + $this->config->delete('foo'); + + try + { + $this->tool->reverse('remove', 'foo'); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertTrue(isset($this->config['foo'])); + $this->assertEquals('', $this->config['foo']); + + // update_if_equals $this->config->set('foo', 'bar'); try -- cgit v1.2.1 From e8a3028ea6505942f6f192105b75dabc177dae44 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 2 Nov 2013 19:26:45 +0100 Subject: [ticket/11995] Remove exceptions and split reverse into different tests PHPBB3-11995 --- tests/dbal/migrator_tool_config_test.php | 99 ++++++++------------------------ 1 file changed, 24 insertions(+), 75 deletions(-) (limited to 'tests') diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php index d007e36da1..807399385c 100644 --- a/tests/dbal/migrator_tool_config_test.php +++ b/tests/dbal/migrator_tool_config_test.php @@ -20,35 +20,24 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case public function test_add() { - try - { - $this->tool->add('foo', 'bar'); - } - catch (Exception $e) - { - $this->fail($e); - } + $this->tool->add('foo', 'bar'); $this->assertEquals('bar', $this->config['foo']); + } - try - { - $this->tool->add('foo', 'bar'); - $this->fail('Exception not thrown'); - } - catch (Exception $e) {} + public function test_add_twice() + { + $this->tool->add('foo', 'bar'); + $this->assertEquals('bar', $this->config['foo']); + + $this->tool->add('foo', 'bar2'); + $this->assertEquals('bar', $this->config['foo']); } public function test_update() { $this->config->set('foo', 'bar'); - try - { - $this->tool->update('foo', 'bar2'); - } - catch (Exception $e) - { - $this->fail($e); - } + + $this->tool->update('foo', 'bar2'); $this->assertEquals('bar2', $this->config['foo']); } @@ -56,24 +45,10 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case { $this->config->set('foo', 'bar'); - try - { - $this->tool->update_if_equals('', 'foo', 'bar2'); - } - catch (Exception $e) - { - $this->fail($e); - } + $this->tool->update_if_equals('', 'foo', 'bar2'); $this->assertEquals('bar', $this->config['foo']); - try - { - $this->tool->update_if_equals('bar', 'foo', 'bar2'); - } - catch (Exception $e) - { - $this->fail($e); - } + $this->tool->update_if_equals('bar', 'foo', 'bar2'); $this->assertEquals('bar2', $this->config['foo']); } @@ -81,57 +56,31 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case { $this->config->set('foo', 'bar'); - try - { - $this->tool->remove('foo'); - } - catch (Exception $e) - { - $this->fail($e); - } + $this->tool->remove('foo'); $this->assertFalse(isset($this->config['foo'])); } - public function test_reverse() + public function test_reverse_add() { - // add $this->config->set('foo', 'bar'); - try - { - $this->tool->reverse('add', 'foo'); - } - catch (Exception $e) - { - $this->fail($e); - } + $this->tool->reverse('add', 'foo'); $this->assertFalse(isset($this->config['foo'])); + } - // remove + public function test_reverse_remove() + { $this->config->delete('foo'); - try - { - $this->tool->reverse('remove', 'foo'); - } - catch (Exception $e) - { - $this->fail($e); - } - $this->assertTrue(isset($this->config['foo'])); + $this->tool->reverse('remove', 'foo'); $this->assertEquals('', $this->config['foo']); + } - // update_if_equals + public function test_reverse_update_if_equals() + { $this->config->set('foo', 'bar'); - try - { - $this->tool->reverse('update_if_equals', 'test', 'foo', 'bar'); - } - catch (Exception $e) - { - $this->fail($e); - } + $this->tool->reverse('update_if_equals', 'test', 'foo', 'bar'); $this->assertEquals('test', $this->config['foo']); } } -- cgit v1.2.1 From c609f25bae6aee2b7fab8dfeb8b3a58e2c2f396f Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 4 Nov 2013 12:15:02 -0600 Subject: [ticket/11943] Add test for DEFINE $VAR = false PHPBB3-11943 --- tests/template/template_test.php | 2 +- tests/template/templates/define.html | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 39eb08ab79..0ff469779d 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -158,7 +158,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), array(), - "xyz\nabc\n\$VALUE == 'abc'\n(\$VALUE == 'abc')\n((\$VALUE == 'abc'))\n!\$DOESNT_EXIST\n(!\$DOESNT_EXIST)\nabc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?[]|foobar|", + "xyz\nabc\n\$VALUE == 'abc'\n(\$VALUE == 'abc')\n((\$VALUE == 'abc'))\n!\$DOESNT_EXIST\n(!\$DOESNT_EXIST)\nabc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?[]|foobar|false", ), array( 'define_advanced.html', diff --git a/tests/template/templates/define.html b/tests/template/templates/define.html index e7ce7f7def..276d2ebb99 100644 --- a/tests/template/templates/define.html +++ b/tests/template/templates/define.html @@ -29,3 +29,9 @@ $VALUE == 'abc' [{$VALUE}] foobar|{$TEST}| + + +true + +false + -- cgit v1.2.1 From 7aa4d8fce2e61776d5f2dbf67386a589bcd7d634 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 7 Nov 2013 12:56:10 +0100 Subject: [ticket/11927] Correctly add new files on update Currently we ignore language and style files when the directory where they go to do not exist. However in 3.1 we introduce some new sub directories: * language/en/email/short/ * styles/prosilver/theme/en/ So we need to change our check to look whether the language or style exist, rather then the parent directory. PHPBB3-11927 --- .../ignore_new_file_on_update_test.php | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/functions_install/ignore_new_file_on_update_test.php (limited to 'tests') diff --git a/tests/functions_install/ignore_new_file_on_update_test.php b/tests/functions_install/ignore_new_file_on_update_test.php new file mode 100644 index 0000000000..0c05cc6907 --- /dev/null +++ b/tests/functions_install/ignore_new_file_on_update_test.php @@ -0,0 +1,39 @@ +assertEquals($expected, ignore_new_file_on_update($phpbb_root_path, $file)); + } +} -- cgit v1.2.1 From 95348c8f6d64302d2d525f2ba1a9408f1510144b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 7 Nov 2013 13:49:55 +0100 Subject: [ticket/11927] Prefix function with phpbb_ PHPBB3-11927 --- tests/functions_install/ignore_new_file_on_update_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/functions_install/ignore_new_file_on_update_test.php b/tests/functions_install/ignore_new_file_on_update_test.php index 0c05cc6907..ae1dde96f7 100644 --- a/tests/functions_install/ignore_new_file_on_update_test.php +++ b/tests/functions_install/ignore_new_file_on_update_test.php @@ -34,6 +34,6 @@ class phpbb_functions_install_ignore_new_file_on_update_test extends phpbb_test_ public function test_ignore_new_file_on_update($file, $expected) { global $phpbb_root_path; - $this->assertEquals($expected, ignore_new_file_on_update($phpbb_root_path, $file)); + $this->assertEquals($expected, phpbb_ignore_new_file_on_update($phpbb_root_path, $file)); } } -- cgit v1.2.1 From f98ddb23e8b60cd30bcbaa4c1c2ce772c0cbcc96 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 1 Nov 2013 16:25:22 +0100 Subject: [ticket/11994] Fix functional extension tests PHPBB3-11994 --- tests/functional/extension_acp_test.php | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'tests') diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 401b18f11c..029f13b4f1 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -83,18 +83,18 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertCount(5, $crawler->filter('.ext_disabled')); $this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text()); - $this->assertContainsLang('PURGE', $crawler->filter('.ext_enabled')->eq(0)->text()); + $this->assertContainsLang('EXTENSION_UNINSTALL', $crawler->filter('.ext_enabled')->eq(0)->text()); - $this->assertContains('The "test2" extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text()); + $this->assertContains('The “test2” extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text()); - $this->assertContains('The "test3" extension is not valid.', $crawler->filter('.ext_disabled')->eq(1)->text()); + $this->assertContains('The “test3” extension is not valid.', $crawler->filter('.ext_disabled')->eq(1)->text()); $this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(2)->text()); $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContainsLang('ENABLE', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContainsLang('PURGE', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContainsLang('EXTENSION_UNINSTALL', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContains('The "bar" extension is not valid.', $crawler->filter('.ext_disabled')->eq(3)->text()); + $this->assertContains('The “bar” extension is not valid.', $crawler->filter('.ext_disabled')->eq(3)->text()); } public function test_details() @@ -148,8 +148,8 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text()); $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('ENABLE_CONFIRM', $crawler->filter('html')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'vendor/moo'), $crawler->filter('html')->text()); } public function test_disable_pre() @@ -160,8 +160,8 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text()); $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContainsLang('DISABLE_CONFIRM', $crawler->filter('html')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid); + $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'foo'), $crawler->filter('html')->text()); } public function test_purge_pre() @@ -170,19 +170,19 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=test2&sid=' . $this->sid); $this->assertContains('The required file does not exist', $crawler->filter('html')->text()); - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContainsLang('PURGE_CONFIRM', $crawler->filter('html')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=foo&sid=' . $this->sid); + $this->assertContains($this->lang('EXTENSION_UNINSTALL_CONFIRM', 'foo'), $crawler->filter('html')->text()); } public function test_actions() { - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('ENABLE_SUCCESS', $crawler->filter('html')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $crawler->filter('html')->text()); - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('DISABLE_SUCCESS', $crawler->filter('html')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $crawler->filter('html')->text()); - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('PURGE_SUCCESS', $crawler->filter('html')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContainsLang('EXTENSION_UNINSTALL_SUCCESS', $crawler->filter('html')->text()); } } -- cgit v1.2.1 From e60588a25943f7cf662a5d759bfc8c1936da75a7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 1 Nov 2013 16:26:04 +0100 Subject: [ticket/11994] Replace spaces with tabs PHPBB3-11994 --- tests/functional/extension_acp_test.php | 110 ++++++++++++++++---------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'tests') diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 029f13b4f1..d466e01c80 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -77,59 +77,59 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case public function test_list() { - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid); - $this->assertCount(1, $crawler->filter('.ext_enabled')); - $this->assertCount(5, $crawler->filter('.ext_disabled')); + $this->assertCount(1, $crawler->filter('.ext_enabled')); + $this->assertCount(5, $crawler->filter('.ext_disabled')); - $this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text()); - $this->assertContainsLang('EXTENSION_UNINSTALL', $crawler->filter('.ext_enabled')->eq(0)->text()); + $this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text()); + $this->assertContainsLang('EXTENSION_UNINSTALL', $crawler->filter('.ext_enabled')->eq(0)->text()); - $this->assertContains('The “test2” extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text()); + $this->assertContains('The “test2” extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text()); - $this->assertContains('The “test3” extension is not valid.', $crawler->filter('.ext_disabled')->eq(1)->text()); + $this->assertContains('The “test3” extension is not valid.', $crawler->filter('.ext_disabled')->eq(1)->text()); - $this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContainsLang('EXTENSION_UNINSTALL', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContainsLang('EXTENSION_UNINSTALL', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContains('The “bar” extension is not valid.', $crawler->filter('.ext_disabled')->eq(3)->text()); + $this->assertContains('The “bar” extension is not valid.', $crawler->filter('.ext_disabled')->eq(3)->text()); } public function test_details() { - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=foo&sid=' . $this->sid); - - $validation = array( - 'DISPLAY_NAME' => 'phpBB Foo Extension', - 'CLEAN_NAME' => 'foo/example', - 'TYPE' => 'phpbb-extension', - 'DESCRIPTION' => 'An example/sample extension to be used for testing purposes in phpBB Development.', - 'VERSION' => '1.0.0', - 'TIME' => '2012-02-15 01:01:01', - 'LICENCE' => 'GPL-2.0', - 'PHPBB_VERSION' => '3.1.*@dev', - 'PHP_VERSION' => '>=5.3', - 'AUTHOR_NAME' => 'John Smith', - 'AUTHOR_EMAIL' => 'email@phpbb.com', - 'AUTHOR_HOMEPAGE' => 'http://phpbb.com', - 'AUTHOR_ROLE' => 'N/A', - ); - - for ($i = 0; $i < $crawler->filter('dl')->count(); $i++) - { - $text = $crawler->filter('dl')->eq($i)->text(); - - $match = false; - - foreach ($validation as $language_key => $expected) - { - if (strpos($text, $this->lang($language_key)) === 0) - { - $match = true; - - $this->assertContains($expected, $text); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=foo&sid=' . $this->sid); + + $validation = array( + 'DISPLAY_NAME' => 'phpBB Foo Extension', + 'CLEAN_NAME' => 'foo/example', + 'TYPE' => 'phpbb-extension', + 'DESCRIPTION' => 'An example/sample extension to be used for testing purposes in phpBB Development.', + 'VERSION' => '1.0.0', + 'TIME' => '2012-02-15 01:01:01', + 'LICENCE' => 'GPL-2.0', + 'PHPBB_VERSION' => '3.1.*@dev', + 'PHP_VERSION' => '>=5.3', + 'AUTHOR_NAME' => 'John Smith', + 'AUTHOR_EMAIL' => 'email@phpbb.com', + 'AUTHOR_HOMEPAGE' => 'http://phpbb.com', + 'AUTHOR_ROLE' => 'N/A', + ); + + for ($i = 0; $i < $crawler->filter('dl')->count(); $i++) + { + $text = $crawler->filter('dl')->eq($i)->text(); + + $match = false; + + foreach ($validation as $language_key => $expected) + { + if (strpos($text, $this->lang($language_key)) === 0) + { + $match = true; + + $this->assertContains($expected, $text); } } @@ -143,10 +143,10 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case public function test_enable_pre() { // Foo is already enabled (redirect to list) - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text()); - $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text()); - $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=foo&sid=' . $this->sid); + $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text()); + $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text()); + $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'vendor/moo'), $crawler->filter('html')->text()); @@ -154,11 +154,11 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case public function test_disable_pre() { - // Moo is not enabled (redirect to list) - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text()); - $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text()); - $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); + // Moo is not enabled (redirect to list) + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text()); + $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text()); + $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid); $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'foo'), $crawler->filter('html')->text()); @@ -166,9 +166,9 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case public function test_purge_pre() { - // test2 is not available (error) - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=test2&sid=' . $this->sid); - $this->assertContains('The required file does not exist', $crawler->filter('html')->text()); + // test2 is not available (error) + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=test2&sid=' . $this->sid); + $this->assertContains('The required file does not exist', $crawler->filter('html')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=foo&sid=' . $this->sid); $this->assertContains($this->lang('EXTENSION_UNINSTALL_CONFIRM', 'foo'), $crawler->filter('html')->text()); -- cgit v1.2.1 From 476464374a159ef90c28f2b58f8655fb706e0360 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 2 Nov 2013 14:57:03 +0100 Subject: [ticket/11994] Update functional tests with display name PHPBB3-11994 --- tests/functional/extension_acp_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index d466e01c80..a99f3cbfa4 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -149,7 +149,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'vendor/moo'), $crawler->filter('html')->text()); + $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('html')->text()); } public function test_disable_pre() @@ -161,7 +161,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'foo'), $crawler->filter('html')->text()); + $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('html')->text()); } public function test_purge_pre() @@ -171,7 +171,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContains('The required file does not exist', $crawler->filter('html')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_UNINSTALL_CONFIRM', 'foo'), $crawler->filter('html')->text()); + $this->assertContains($this->lang('EXTENSION_UNINSTALL_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('html')->text()); } public function test_actions() -- cgit v1.2.1 From 40fcc906a27072ff824b503017dac14c89181dbb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 2 Nov 2013 23:46:10 +0100 Subject: [ticket/11994] Fix tests after uninstall rename PHPBB3-11994 --- tests/functional/extension_acp_test.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index a99f3cbfa4..83382116b4 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -83,7 +83,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertCount(5, $crawler->filter('.ext_disabled')); $this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text()); - $this->assertContainsLang('EXTENSION_UNINSTALL', $crawler->filter('.ext_enabled')->eq(0)->text()); + $this->assertContainsLang('EXTENSION_DISABLE', $crawler->filter('.ext_enabled')->eq(0)->text()); $this->assertContains('The “test2” extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text()); @@ -92,7 +92,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(2)->text()); $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(2)->text()); $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContainsLang('EXTENSION_UNINSTALL', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContainsLang('EXTENSION_DELETE_DATA', $crawler->filter('.ext_disabled')->eq(2)->text()); $this->assertContains('The “bar” extension is not valid.', $crawler->filter('.ext_disabled')->eq(3)->text()); } @@ -164,14 +164,14 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('html')->text()); } - public function test_purge_pre() + public function test_delete_data_pre() { // test2 is not available (error) - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=test2&sid=' . $this->sid); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=test2&sid=' . $this->sid); $this->assertContains('The required file does not exist', $crawler->filter('html')->text()); - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_UNINSTALL_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('html')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=foo&sid=' . $this->sid); + $this->assertContains($this->lang('EXTENSION_DELETE_DATA_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('html')->text()); } public function test_actions() @@ -182,7 +182,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid); $this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $crawler->filter('html')->text()); - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('EXTENSION_UNINSTALL_SUCCESS', $crawler->filter('html')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $crawler->filter('html')->text()); } } -- cgit v1.2.1 From 12a6e2c603846db0054e27494429292316b209db Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 3 Nov 2013 20:29:14 +0100 Subject: [ticket/11994] Filter crawler for better search comparisons PHPBB3-11994 --- tests/functional/extension_acp_test.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 83382116b4..7db0067499 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -144,45 +144,45 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case { // Foo is already enabled (redirect to list) $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text()); - $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text()); - $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); + $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('div.main thead')->text()); + $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('div.main thead')->text()); + $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('html')->text()); + $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('.errorbox')->text()); } public function test_disable_pre() { // Moo is not enabled (redirect to list) $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text()); - $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text()); - $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text()); + $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('div.main thead')->text()); + $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('div.main thead')->text()); + $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('html')->text()); + $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('.errorbox')->text()); } public function test_delete_data_pre() { // test2 is not available (error) $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=test2&sid=' . $this->sid); - $this->assertContains('The required file does not exist', $crawler->filter('html')->text()); + $this->assertContains('The required file does not exist', $crawler->filter('.errorbox')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_DELETE_DATA_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('html')->text()); + $this->assertContains($this->lang('EXTENSION_DELETE_DATA_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('.errorbox')->text()); } public function test_actions() { $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $crawler->filter('html')->text()); + $this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $crawler->filter('.successbox')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $crawler->filter('html')->text()); + $this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $crawler->filter('.successbox')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $crawler->filter('html')->text()); + $this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $crawler->filter('.successbox')->text()); } } -- cgit v1.2.1 From d17bf9aa273d8cd3dfb730b506f7aac2bd51a97a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 3 Nov 2013 20:30:09 +0100 Subject: [ticket/11994] "Delete data" is only available for disabled extensions PHPBB3-11994 --- tests/functional/extension_acp_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 7db0067499..0cd03d8ccb 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -170,8 +170,8 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=test2&sid=' . $this->sid); $this->assertContains('The required file does not exist', $crawler->filter('.errorbox')->text()); - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=foo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_DELETE_DATA_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('.errorbox')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContains($this->lang('EXTENSION_DELETE_DATA_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('.errorbox')->text()); } public function test_actions() -- cgit v1.2.1 From bf7eab423edc9bde69c960bb182b8313be7d5e3a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 3 Nov 2013 23:39:48 +0100 Subject: [ticket/11994] Fix functional tests PHPBB3-11994 --- tests/functional/extension_acp_test.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 0cd03d8ccb..44bb895f67 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -170,8 +170,14 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=test2&sid=' . $this->sid); $this->assertContains('The required file does not exist', $crawler->filter('.errorbox')->text()); + // foo is not disabled (redirect to list) + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=foo&sid=' . $this->sid); + $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('div.main thead')->text()); + $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('div.main thead')->text()); + $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_DELETE_DATA_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('.errorbox')->text()); + $this->assertContains('Are you sure that you wish to delete the data associated with “phpBB Moo Extension”?', $crawler->filter('.errorbox')->text()); } public function test_actions() -- cgit v1.2.1 From 7a8a4408952659d59a3c92108eae6ef0f10a5bb3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 8 Nov 2013 14:08:55 +0100 Subject: [ticket/12002] Change functional test to use link hash PHPBB3-12002 --- tests/functional/extension_acp_test.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 44bb895f67..5d391e42f7 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -182,13 +182,34 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case public function test_actions() { + // Access enable page without hash $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContainsLang('FORM_INVALID', $crawler->filter('.errorbox')->text()); + + // Correctly submit the enable form + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $form = $crawler->selectButton('enable')->form(); + $crawler = self::submit($form); $this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $crawler->filter('.successbox')->text()); + // Access disable page without hash $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContainsLang('FORM_INVALID', $crawler->filter('.errorbox')->text()); + + // Correctly submit the disable form + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $form = $crawler->selectButton('disable')->form(); + $crawler = self::submit($form); $this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $crawler->filter('.successbox')->text()); + // Access delete_data page without hash $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $this->assertContainsLang('FORM_INVALID', $crawler->filter('.errorbox')->text()); + + // Correctly submit the delete data form + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); + $form = $crawler->selectButton('delete_data')->form(); + $crawler = self::submit($form); $this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $crawler->filter('.successbox')->text()); } } -- cgit v1.2.1 From 2e5117a71eb64c734e5738235c44ef92818ca33b Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 9 Nov 2013 11:14:55 -0600 Subject: [ticket/11943] Throw an exception if DEFINE is setup improperly PHPBB3-11943 --- tests/template/template_test.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 0ff469779d..6e9b7d3ee9 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -561,4 +561,12 @@ EOT $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification'); } + + /** + * @expectedException Twig_Error_Syntax + */ + public function test_define_error() + { + $this->run_template('define_error.html', array(), array(), array(), ''); + } } -- cgit v1.2.1 From 64ed46e682564600c8b8688e7d4e49620eb79bb3 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 9 Nov 2013 11:39:35 -0600 Subject: [ticket/11943] Forgot template file for test PHPBB3-11943 --- tests/template/templates/define_error.html | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/template/templates/define_error.html (limited to 'tests') diff --git a/tests/template/templates/define_error.html b/tests/template/templates/define_error.html new file mode 100644 index 0000000000..a272071736 --- /dev/null +++ b/tests/template/templates/define_error.html @@ -0,0 +1,2 @@ + +{$VAR} \ No newline at end of file -- cgit v1.2.1 From 29d3b08d5097ad90a5ed2d26bfc981898732dbab Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 9 Nov 2013 20:33:01 +0100 Subject: [ticket/11896] Add ability to define expected message after posting This change will add the ability to define the expected message after a topic or post has been submitted with the methods create_post() and create_topic(). If the expected message is not 'POST_STORED', we will not try to get the topic and post id. PHPBB3-11896 --- .../test_framework/phpbb_functional_test_case.php | 36 +++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index a0d186e0f2..64c8406adb 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -868,9 +868,10 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $subject * @param string $message * @param array $additional_form_data Any additional form data to be sent in the request + * @param string $expected Lang var of expected message after posting * @return array post_id, topic_id */ - public function create_topic($forum_id, $subject, $message, $additional_form_data = array()) + public function create_topic($forum_id, $subject, $message, $additional_form_data = array(), $expected = '') { $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}"; @@ -880,7 +881,14 @@ class phpbb_functional_test_case extends phpbb_test_case 'post' => true, ), $additional_form_data); - return self::submit_post($posting_url, 'POST_TOPIC', $form_data); + if ($expected !== '') + { + return self::submit_post($posting_url, 'POST_TOPIC', $form_data, $expected); + } + else + { + return self::submit_post($posting_url, 'POST_TOPIC', $form_data); + } } /** @@ -893,9 +901,10 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $subject * @param string $message * @param array $additional_form_data Any additional form data to be sent in the request + * @param string $expected Lang var of expected message after posting * @return array post_id, topic_id */ - public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array()) + public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array(), $expected = '') { $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}"; @@ -905,7 +914,14 @@ class phpbb_functional_test_case extends phpbb_test_case 'post' => true, ), $additional_form_data); - return self::submit_post($posting_url, 'POST_REPLY', $form_data); + if ($expected !== '') + { + return self::submit_post($posting_url, 'POST_REPLY', $form_data, $expected); + } + else + { + return self::submit_post($posting_url, 'POST_REPLY', $form_data); + } } /** @@ -914,9 +930,10 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $posting_url * @param string $posting_contains * @param array $form_data - * @return array post_id, topic_id + * @param string $expected Lang var of expected message after posting + * @return array|null post_id, topic_id if message is 'POST_STORED' */ - protected function submit_post($posting_url, $posting_contains, $form_data) + protected function submit_post($posting_url, $posting_contains, $form_data, $expected = 'POST_STORED') { $this->add_lang('posting'); @@ -945,7 +962,12 @@ class phpbb_functional_test_case extends phpbb_test_case // 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()); + $this->assertContains($this->lang($expected), $crawler->filter('html')->text()); + + if ($expected !== 'POST_STORED') + { + return; + } $url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri(); return array( -- cgit v1.2.1 From 95c2b12bf7be4e6ad1070d7dd11a9afd7fc1efa8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 9 Nov 2013 20:35:37 +0100 Subject: [ticket/11896] Add functional tests for marking all notifications read PHPBB3-11896 --- tests/functional/notification_test.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'tests') diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index 7f33ad1859..dd1b8ec981 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -52,4 +52,37 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case $this->assert_checkbox_is_unchecked($cplist, $checkbox_name); } } + + public function test_mark_notifications_read() + { + // Create a new standard user + $this->create_user('notificationtestuser'); + $this->add_user_group('NEWLY_REGISTERED', array('notificationtestuser')); + $this->login('notificationtestuser'); + $crawler = self::request('GET', 'index.php'); + $this->assertContains('notificationtestuser', $crawler->filter('.icon-logout')->text()); + + // Post a new post that needs approval + $this->create_post(2, 1, 'Re: Welcome to phpBB3', 'This is a test [b]post[/b] posted by notificationtestuser.', array(), 'POST_STORED_MOD'); + $crawler = self::request('GET', "viewtopic.php?t=1&sid={$this->sid}"); + $this->assertNotContains('This is a test post posted by notificationtestuser.', $crawler->filter('html')->text()); + + // logout + $crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout'); + + // admin login + $this->login(); + $this->add_lang('ucp'); + $crawler = self::request('GET', 'ucp.php?i=ucp_notifications'); + + // At least one notification should exist + $this->assertGreaterThan(0, $crawler->filter('#notification_list_button strong')->text()); + + // Get form token + $link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri(); + $crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); + $form = $crawler->selectButton($this->lang('YES'))->form(); + $crawler = self::submit($form); + $this->assertEquals(0, $crawler->filter('#notification_list_button strong')->text()); + } } -- cgit v1.2.1 From 32ba402c34922fca9bd0d8a5d02bde62e7334d1a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 11 Nov 2013 00:01:31 +0100 Subject: [ticket/11525] Compare correct array to expected value PHPBB3-11525 --- tests/avatar/manager_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index f687f7bc86..47d19be66d 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -252,7 +252,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase foreach ($output as $key => $value) { $this->assertArrayHasKey($key, $cleaned_row); - $this->assertEquals($output[$key], $value); + $this->assertEquals($cleaned_row[$key], $value); } } -- cgit v1.2.1 From a74c560ecafc0c6e63f1e0fc8191e85b066a05ef Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 11 Nov 2013 00:02:12 +0100 Subject: [ticket/11525] Fix expected value of group avatar test PHPBB3-11525 --- tests/avatar/manager_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 47d19be66d..e9f622bfde 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -233,7 +233,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase ), array( 'avatar' => '', - 'id' => 4, + 'id' => 'g4', 'user_id' => 5, ), 'group', -- cgit v1.2.1 From 47e364ae68a92dbf2107c56a2165b219e4312b50 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 11 Nov 2013 10:59:17 -0600 Subject: [ticket/11943] New line at EOF for define_error.html PHPBB3-11943 --- tests/template/templates/define_error.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/template/templates/define_error.html b/tests/template/templates/define_error.html index a272071736..72ab1ba033 100644 --- a/tests/template/templates/define_error.html +++ b/tests/template/templates/define_error.html @@ -1,2 +1,2 @@ -{$VAR} \ No newline at end of file +{$VAR} -- cgit v1.2.1 From fbf5911ac54c83d439121e90032afca0ec2a7fc4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 13 Nov 2013 17:38:58 +0100 Subject: [ticket/12016] Update functional tests to use service for event listeners PHPBB3-12016 --- tests/functional/fixtures/ext/foo/bar/config/services.yml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/functional/fixtures/ext/foo/bar/config/services.yml b/tests/functional/fixtures/ext/foo/bar/config/services.yml index 3bca4c6567..64e1163408 100644 --- a/tests/functional/fixtures/ext/foo/bar/config/services.yml +++ b/tests/functional/fixtures/ext/foo/bar/config/services.yml @@ -4,3 +4,12 @@ services: arguments: - @controller.helper - @template + foo_bar.listener.permission: + class: foo\bar\event\permission + tags: + - { name: event.listener } + foo_bar.listener.user_setup: + class: foo\bar\event\user_setup + tags: + - { name: event.listener } + -- cgit v1.2.1 From 13a4ceedb18ba938d3cd18e2f68707385bc9283a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 13 Nov 2013 18:27:40 +0100 Subject: [ticket/11525] Use foreach instead of array_walk in method clean_row() This approach is cleaner and probably even faster the previous ways that included using array_walk() or array_map() and other helper functions and methods. PHPBB3-11525 --- tests/avatar/manager_test.php | 50 +++++++++++-------------------------------- 1 file changed, 13 insertions(+), 37 deletions(-) (limited to 'tests') diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index e9f622bfde..f29f7aee95 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -152,31 +152,20 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase return array( array( array( - 'user_avatar' => '', - 'user_avatar_type' => '', - 'user_avatar_width' => '', + 'user_avatar' => '', + 'user_avatar_type' => '', + 'user_avatar_width' => '', 'user_avatar_height' => '', + 'group_avatar' => '', ), array( - 'avatar' => '', - 'avatar_type' => '', - 'avatar_width' => '', - 'avatar_height' => '', - ), - ), - array( - array( - 'group_avatar' => '', - 'group_avatar_type' => '', - 'group_avatar_width' => '', - 'group_avatar_height' => '', - ), - array( - 'avatar' => '', - 'avatar_type' => '', - 'avatar_width' => '', - 'avatar_height' => '', + 'user_avatar' => '', + 'user_avatar_type' => '', + 'user_avatar_width' => '', + 'user_avatar_height' => '', + 'group_avatar' => '', ), + 'foobar', ), array( array(), @@ -187,20 +176,6 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase 'avatar_height' => '', ), ), - array( - array( - 'foobar_avatar' => '', - 'foobar_avatar_type' => '', - 'foobar_avatar_width' => '', - 'foobar_avatar_height' => '', - ), - array( - 'foobar_avatar' => '', - 'foobar_avatar_type' => '', - 'foobar_avatar_width' => '', - 'foobar_avatar_height' => '', - ), - ), array( array( 'user_avatar' => '', @@ -208,8 +183,9 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase 'group_id' => 4, ), array( - 'avatar' => '', - 'id' => 4, + 'user_avatar' => '', + 'user_id' => 5, + 'group_id' => 4, ), ), array( -- cgit v1.2.1 From 009a1303f59628417573b47b162690b057594953 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 14 Nov 2013 00:14:04 +0100 Subject: [ticket/12017] Remove IN_PHPBB defined check PHPBB3-12017 --- tests/functional/fixtures/ext/foo/bar/event/permission.php | 9 --------- tests/functional/fixtures/ext/foo/bar/event/user_setup.php | 9 --------- 2 files changed, 18 deletions(-) (limited to 'tests') diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission.php b/tests/functional/fixtures/ext/foo/bar/event/permission.php index 92e24074ad..9b319dd35f 100644 --- a/tests/functional/fixtures/ext/foo/bar/event/permission.php +++ b/tests/functional/fixtures/ext/foo/bar/event/permission.php @@ -10,15 +10,6 @@ namespace foo\bar\event; -/** -* @ignore -*/ - -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Event listener */ diff --git a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php index 1409f97470..8fa7ac97da 100644 --- a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php +++ b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php @@ -10,15 +10,6 @@ namespace foo\bar\event; -/** -* @ignore -*/ - -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Event listener */ -- cgit v1.2.1 From 4e2bb6ef535a5188aeda6d04286b6b9bb8825c72 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 14 Nov 2013 00:14:53 +0100 Subject: [ticket/12017] Copy config/ dir so events work PHPBB3-12017 --- tests/functional/extension_controller_test.php | 2 ++ tests/functional/extension_global_lang_test.php | 3 ++- tests/functional/extension_permission_lang_test.php | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 41bd48c204..37752b8fbb 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -19,6 +19,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c static protected $fixtures = array( 'foo/bar/config/', 'foo/bar/controller/', + 'foo/bar/event/', + 'foo/bar/language/en/', 'foo/bar/styles/prosilver/template/', ); diff --git a/tests/functional/extension_global_lang_test.php b/tests/functional/extension_global_lang_test.php index fb8f87e6de..094eda8257 100644 --- a/tests/functional/extension_global_lang_test.php +++ b/tests/functional/extension_global_lang_test.php @@ -17,8 +17,9 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_ static private $helper; static protected $fixtures = array( - 'foo/bar/language/en/', + 'foo/bar/config/', 'foo/bar/event/', + 'foo/bar/language/en/', ); static public function setUpBeforeClass() diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php index 19adb89819..e922abdaf1 100644 --- a/tests/functional/extension_permission_lang_test.php +++ b/tests/functional/extension_permission_lang_test.php @@ -17,8 +17,9 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t static private $helper; static protected $fixtures = array( - 'foo/bar/language/en/', + 'foo/bar/config/', 'foo/bar/event/', + 'foo/bar/language/en/', ); static public function setUpBeforeClass() -- cgit v1.2.1 From 1e73e0c9544d2601127b7179fdbd0724370e8b04 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 14 Nov 2013 00:15:23 +0100 Subject: [ticket/12017] Fix phpbb requirement in composer.json PHPBB3-12017 --- tests/functional/fixtures/ext/foo/bar/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/functional/fixtures/ext/foo/bar/composer.json b/tests/functional/fixtures/ext/foo/bar/composer.json index cb9dbc9514..e3e5fc21cd 100644 --- a/tests/functional/fixtures/ext/foo/bar/composer.json +++ b/tests/functional/fixtures/ext/foo/bar/composer.json @@ -14,7 +14,7 @@ }], "require": { "php": ">=5.3", - "phpbb": "3.1.*@dev" + "phpbb/phpbb": "3.1.*@dev" }, "extra": { "display-name": "phpBB 3.1 Extension Testing" -- cgit v1.2.1 From 287c2550b8689a6fd34043ec4b5652997e9a6ab7 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Wed, 13 Nov 2013 23:58:21 -0800 Subject: [ticket/12008] Update the run time value for the prune notifications cron task PHPBB3-12008 --- tests/notification/base.php | 1 + tests/notification/submit_post_base.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/notification/base.php b/tests/notification/base.php index 549545f01b..f6333866c3 100644 --- a/tests/notification/base.php +++ b/tests/notification/base.php @@ -70,6 +70,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case array(), $this->container, $this->user_loader, + $this->config, $this->db, $this->cache, $this->user, diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 8597c626a4..a9ed59686a 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -118,7 +118,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case // Notification Manager $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(), - $phpbb_container, $user_loader, $db, $cache, $user, + $phpbb_container, $user_loader, $config, $db, $cache, $user, $phpbb_root_path, $phpEx, NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE); $phpbb_container->set('notification_manager', $phpbb_notifications); -- cgit v1.2.1 From 308329b5479d16e104c9eb7372222fee67ccdbf5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 14 Nov 2013 15:09:49 +0100 Subject: [ticket/11896] Minor code improvements in phpbb_functional_test_case Use assertContainsLang() and get rid of unnecessary logic in create_post() and create_topic(). The docblocks were also slightly improved. PHPBB3-11896 --- .../test_framework/phpbb_functional_test_case.php | 28 ++++++---------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'tests') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 64c8406adb..876e42a4c2 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -868,10 +868,10 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $subject * @param string $message * @param array $additional_form_data Any additional form data to be sent in the request - * @param string $expected Lang var of expected message after posting + * @param string $expected Lang var of expected message after posting or null * @return array post_id, topic_id */ - public function create_topic($forum_id, $subject, $message, $additional_form_data = array(), $expected = '') + public function create_topic($forum_id, $subject, $message, $additional_form_data = array(), $expected = 'POST_STORED') { $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}"; @@ -881,14 +881,7 @@ class phpbb_functional_test_case extends phpbb_test_case 'post' => true, ), $additional_form_data); - if ($expected !== '') - { - return self::submit_post($posting_url, 'POST_TOPIC', $form_data, $expected); - } - else - { - return self::submit_post($posting_url, 'POST_TOPIC', $form_data); - } + return self::submit_post($posting_url, 'POST_TOPIC', $form_data, $expected); } /** @@ -901,10 +894,10 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $subject * @param string $message * @param array $additional_form_data Any additional form data to be sent in the request - * @param string $expected Lang var of expected message after posting + * @param string $expected Lang var of expected message after posting or null * @return array post_id, topic_id */ - public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array(), $expected = '') + public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array(), $expected = 'POST_STORED') { $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}"; @@ -914,14 +907,7 @@ class phpbb_functional_test_case extends phpbb_test_case 'post' => true, ), $additional_form_data); - if ($expected !== '') - { - return self::submit_post($posting_url, 'POST_REPLY', $form_data, $expected); - } - else - { - return self::submit_post($posting_url, 'POST_REPLY', $form_data); - } + return self::submit_post($posting_url, 'POST_REPLY', $form_data, $expected); } /** @@ -962,7 +948,7 @@ class phpbb_functional_test_case extends phpbb_test_case // 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($expected), $crawler->filter('html')->text()); + $this->assertContainsLang($expected, $crawler->filter('html')->text()); if ($expected !== 'POST_STORED') { -- cgit v1.2.1 From 7f10312bf21dba335a863fb1222db8b9ed64ef0e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 14 Nov 2013 15:17:25 +0100 Subject: [ticket/11896] Correctly document return of null in docblocks Also got rid of previous incorrect comment in docblocks. PHPBB3-11896 --- tests/test_framework/phpbb_functional_test_case.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 876e42a4c2..eba5a2dfdf 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -868,8 +868,8 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $subject * @param string $message * @param array $additional_form_data Any additional form data to be sent in the request - * @param string $expected Lang var of expected message after posting or null - * @return array post_id, topic_id + * @param string $expected Lang var of expected message after posting + * @return array|null post_id, topic_id if message is 'POST_STORED' */ public function create_topic($forum_id, $subject, $message, $additional_form_data = array(), $expected = 'POST_STORED') { @@ -894,8 +894,8 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $subject * @param string $message * @param array $additional_form_data Any additional form data to be sent in the request - * @param string $expected Lang var of expected message after posting or null - * @return array post_id, topic_id + * @param string $expected Lang var of expected message after posting + * @return array|null post_id, topic_id if message is 'POST_STORED' */ public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array(), $expected = 'POST_STORED') { -- cgit v1.2.1 From 632d6e96218c70ee89c411679304e2529efff514 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 19 Nov 2013 00:23:23 +0100 Subject: [ticket/12023] Add test for failing .css copy PHPBB3-12023 --- tests/functions_install/ignore_new_file_on_update_test.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/functions_install/ignore_new_file_on_update_test.php b/tests/functions_install/ignore_new_file_on_update_test.php index ae1dde96f7..703da4e435 100644 --- a/tests/functions_install/ignore_new_file_on_update_test.php +++ b/tests/functions_install/ignore_new_file_on_update_test.php @@ -25,6 +25,8 @@ class phpbb_functions_install_ignore_new_file_on_update_test extends phpbb_test_ array('styles/prosilver/theme/en/icon_user_online.gif', false), array('styles/prosilver/theme/languagewillneverexist/icon_user_online.gif', true), + + array('styles/prosilver/theme/imageset.css', false), ); } -- cgit v1.2.1