mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/11450] Test the extensions details page in ACP Customise Tab
PHPBB3-11450
This commit is contained in:
parent
62f35121d9
commit
269c2ce98d
2 changed files with 127 additions and 0 deletions
23
tests/functional/fixtures/ext/foo/bar/composer.json
Normal file
23
tests/functional/fixtures/ext/foo/bar/composer.json
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
104
tests/functional/metadata_manager_test.php
Normal file
104
tests/functional/metadata_manager_test.php
Normal file
|
@ -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('>=5.3', $this->client->getResponse()->getContent());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue