aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-03-21 15:19:26 +0100
committerJoas Schilling <nickvergessen@gmx.de>2013-05-08 08:47:22 +0200
commit269c2ce98de5b55a713e998aacdaa5500d32b617 (patch)
tree197fbb481a547b29dae0aaa1680e53ccadcb8238
parent62f35121d948bd177004628a4be2b4e8810a50bd (diff)
downloadforums-269c2ce98de5b55a713e998aacdaa5500d32b617.tar
forums-269c2ce98de5b55a713e998aacdaa5500d32b617.tar.gz
forums-269c2ce98de5b55a713e998aacdaa5500d32b617.tar.bz2
forums-269c2ce98de5b55a713e998aacdaa5500d32b617.tar.xz
forums-269c2ce98de5b55a713e998aacdaa5500d32b617.zip
[ticket/11450] Test the extensions details page in ACP Customise Tab
PHPBB3-11450
-rw-r--r--tests/functional/fixtures/ext/foo/bar/composer.json23
-rw-r--r--tests/functional/metadata_manager_test.php104
2 files changed, 127 insertions, 0 deletions
diff --git a/tests/functional/fixtures/ext/foo/bar/composer.json b/tests/functional/fixtures/ext/foo/bar/composer.json
new file mode 100644
index 0000000000..50a8a7358a
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/bar/composer.json
@@ -0,0 +1,23 @@
+{
+ "name": "foo/bar",
+ "type": "phpbb3-extension",
+ "description": "Testing extensions",
+ "homepage": "",
+ "version": "1.0.0",
+ "time": "2013-03-21 01:01:01",
+ "licence": "GPL-2.0",
+ "authors": [{
+ "name": "Joas Schilling",
+ "username": "nickvergessen",
+ "email": "nickvergessen@phpbb.com",
+ "homepage": "http://www.phpbb.com",
+ "role": "Developer"
+ }],
+ "require": {
+ "php": ">=5.3",
+ "phpbb": ">=3.1.0-dev"
+ },
+ "extra": {
+ "display-name": "phpBB 3.1 Extension Testing"
+ }
+} \ No newline at end of file
diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php
new file mode 100644
index 0000000000..0f5b49f01e
--- /dev/null
+++ b/tests/functional/metadata_manager_test.php
@@ -0,0 +1,104 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case
+{
+ protected $phpbb_extension_manager;
+
+ static protected $fixtures = array(
+ 'foo/bar/composer.json',
+ );
+
+ /**
+ * This should only be called once before the tests are run.
+ * This is used to copy the fixtures to the phpBB install
+ */
+ static public function setUpBeforeClass()
+ {
+ global $phpbb_root_path;
+ parent::setUpBeforeClass();
+
+ $directories = array(
+ $phpbb_root_path . 'ext/foo/bar/',
+ );
+
+ foreach ($directories as $dir)
+ {
+ if (!is_dir($dir))
+ {
+ mkdir($dir, 0777, true);
+ }
+ }
+
+ foreach (self::$fixtures as $fixture)
+ {
+ copy(
+ "tests/functional/fixtures/ext/$fixture",
+ "{$phpbb_root_path}ext/$fixture");
+ }
+ }
+
+ /**
+ * This should only be called once after the tests are run.
+ * This is used to remove the fixtures from the phpBB install
+ */
+ static public function tearDownAfterClass()
+ {
+ global $phpbb_root_path;
+
+ foreach (self::$fixtures as $fixture)
+ {
+ unlink("{$phpbb_root_path}ext/$fixture");
+ }
+
+ rmdir("{$phpbb_root_path}ext/foo/bar");
+ rmdir("{$phpbb_root_path}ext/foo");
+ }
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ $this->phpbb_extension_manager = $this->get_extension_manager();
+
+ $this->purge_cache();
+ $this->phpbb_extension_manager->enable('foo/bar');
+
+ $this->login();
+ $this->admin_login();
+ $this->add_lang('acp/extensions');
+ }
+
+ public function test_extensions_list()
+ {
+ $crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid);
+ $this->assert_response_success();
+
+ $this->assertContains($this->lang('EXTENSIONS_EXPLAIN'), $this->client->getResponse()->getContent());
+ $this->assertContains('phpBB 3.1 Extension Testing', $this->client->getResponse()->getContent());
+ $this->assertContains('Details', $this->client->getResponse()->getContent());
+ }
+
+ public function test_permissions_tab()
+ {
+ $crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=foo%2Fbar&sid=' . $this->sid);
+ $this->assert_response_success();
+
+ // Test whether the details are displayed
+ $this->assertContains($this->lang('CLEAN_NAME'), $this->client->getResponse()->getContent());
+ $this->assertContains('foo/bar', $this->client->getResponse()->getContent());
+
+ // Details should be html escaped
+ $this->assertContains($this->lang('PHP_VERSION'), $this->client->getResponse()->getContent());
+ $this->assertContains('&gt;=5.3', $this->client->getResponse()->getContent());
+ }
+}