mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-23 19:58:51 +00:00
The enable or purge operation of an extension could take a long time if an expensive operation needs to be executed on a large set of data. To allow this to succeed from a web interface with max_execution_time set in the webserver's php configuration, subsequent requests must continue the operation started earlier. So individual enable and purge implementations must be able to spread their work across multiple steps. PHPBB3-10323
84 lines
2.5 KiB
PHP
84 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
*
|
|
* @package testing
|
|
* @copyright (c) 2011 phpBB Group
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
*
|
|
*/
|
|
|
|
require_once dirname(__FILE__) . '/../mock/cache.php';
|
|
require_once dirname(__FILE__) . '/ext/bar/bar.php';
|
|
require_once dirname(__FILE__) . '/ext/moo/moo.php';
|
|
|
|
class phpbb_extension_manager_test extends phpbb_database_test_case
|
|
{
|
|
protected $extension_manager;
|
|
protected $class_loader;
|
|
|
|
public function getDataSet()
|
|
{
|
|
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/extensions.xml');
|
|
}
|
|
|
|
protected function setUp()
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->extension_manager = new phpbb_extension_manager(
|
|
$this->new_dbal(),
|
|
'phpbb_ext',
|
|
dirname(__FILE__) . '/',
|
|
'.php',
|
|
new phpbb_mock_cache
|
|
);
|
|
}
|
|
|
|
public function test_available()
|
|
{
|
|
$this->assertEquals(array('bar', 'foo', 'moo'), array_keys($this->extension_manager->all_available()));
|
|
}
|
|
|
|
public function test_enabled()
|
|
{
|
|
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
|
|
}
|
|
|
|
public function test_configured()
|
|
{
|
|
$this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured()));
|
|
}
|
|
|
|
public function test_enable()
|
|
{
|
|
phpbb_ext_bar::$state = 0;
|
|
|
|
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
|
|
$this->extension_manager->enable('bar');
|
|
$this->assertEquals(array('bar', 'foo'), array_keys($this->extension_manager->all_enabled()));
|
|
$this->assertEquals(array('bar', 'foo', 'moo'), array_keys($this->extension_manager->all_configured()));
|
|
|
|
$this->assertEquals(4, phpbb_ext_bar::$state);
|
|
}
|
|
|
|
public function test_disable()
|
|
{
|
|
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
|
|
$this->extension_manager->disable('foo');
|
|
$this->assertEquals(array(), array_keys($this->extension_manager->all_enabled()));
|
|
$this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured()));
|
|
}
|
|
|
|
public function test_purge()
|
|
{
|
|
phpbb_ext_moo::$purged = false;
|
|
|
|
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
|
|
$this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured()));
|
|
$this->extension_manager->purge('moo');
|
|
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
|
|
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_configured()));
|
|
|
|
$this->assertTrue(phpbb_ext_moo::$purged);
|
|
}
|
|
}
|