1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 17:56:52 +02:00

[ticket/12847] Allow the extensions to say if they can be enabled

PHPBB3-12847
This commit is contained in:
Tristan Darricau
2014-07-13 15:44:58 +02:00
parent dd78b564e5
commit 519e64205a
9 changed files with 97 additions and 2 deletions

View File

@@ -13,6 +13,7 @@
require_once dirname(__FILE__) . '/ext/vendor2/bar/ext.php';
require_once dirname(__FILE__) . '/ext/vendor2/foo/ext.php';
require_once dirname(__FILE__) . '/ext/vendor3/foo/ext.php';
require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php';
class phpbb_extension_manager_test extends phpbb_database_test_case
@@ -35,7 +36,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_all_available()
{
// barfoo and vendor3/bar should not listed due to missing composer.json. barfoo also has incorrect dir structure.
$this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo'), array_keys($this->extension_manager->all_available()));
$this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo', 'vendor3/foo'), array_keys($this->extension_manager->all_available()));
}
public function test_all_enabled()
@@ -100,6 +101,18 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$this->assertEquals(4, vendor2\bar\ext::$state);
}
public function test_enable_not_enableable()
{
vendor3\foo\ext::$enabled = false;
$this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled()));
$this->extension_manager->enable('vendor3/foo');
$this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured()));
$this->assertSame(false, vendor3\foo\ext::$enabled);
}
public function test_disable()
{
vendor2\foo\ext::$disabled = false;