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/functional/extension_acp_test.php') 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/functional/extension_acp_test.php') 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/functional/extension_acp_test.php') 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/functional/extension_acp_test.php') 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/functional/extension_acp_test.php') 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/functional/extension_acp_test.php') 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/functional/extension_acp_test.php') 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/functional/extension_acp_test.php') 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