1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

Merge pull request #2729 from Nicofuma/ticket/12847

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

* Nicofuma/ticket/12847:
  [ticket/12847] Allow the extensions to say if they can be enabled
This commit is contained in:
Joas Schilling
2014-08-07 13:00:08 +02:00
9 changed files with 96 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;