[ticket/12777] Add tests

PHPBB3-12777
This commit is contained in:
Tristan Darricau 2014-06-27 16:53:14 +02:00
parent 8e8b493fae
commit e6b8ae6bd5

View file

@ -32,22 +32,57 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$this->extension_manager = $this->create_extension_manager(); $this->extension_manager = $this->create_extension_manager();
} }
public function test_available() public function test_all_available()
{ {
// barfoo and vendor3/bar should not listed due to missing composer.json. barfoo also has incorrect dir structure. // 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'), array_keys($this->extension_manager->all_available()));
} }
public function test_enabled() public function test_all_enabled()
{ {
$this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled()));
} }
public function test_configured() public function test_all_configured()
{ {
$this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); $this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured()));
} }
public function test_is_enabled()
{
$this->assertSame(true, $this->extension_manager->is_enabled('vendor2/foo'));
$this->assertSame(false, $this->extension_manager->is_enabled('vendor/moo'));
$this->assertSame(false, $this->extension_manager->is_enabled('vendor2/bar'));
}
public function test_is_disabled()
{
$this->assertSame(false, $this->extension_manager->is_disabled('vendor2/foo'));
$this->assertSame(true, $this->extension_manager->is_disabled('vendor/moo'));
$this->assertSame(false, $this->extension_manager->is_disabled('vendor2/bar'));
}
public function test_is_purged()
{
$this->assertSame(false, $this->extension_manager->is_purged('vendor2/foo'));
$this->assertSame(false, $this->extension_manager->is_purged('vendor/moo'));
$this->assertSame(true, $this->extension_manager->is_purged('vendor2/bar'));
}
public function test_is_configured()
{
$this->assertSame(true, $this->extension_manager->is_configured('vendor2/foo'));
$this->assertSame(true, $this->extension_manager->is_configured('vendor/moo'));
$this->assertSame(false, $this->extension_manager->is_configured('vendor2/bar'));
}
public function test_is_available()
{
$this->assertSame(true, $this->extension_manager->is_available('vendor2/foo'));
$this->assertSame(true, $this->extension_manager->is_available('vendor/moo'));
$this->assertSame(true, $this->extension_manager->is_available('vendor2/bar'));
}
public function test_enable() public function test_enable()
{ {
vendor2\bar\ext::$state = 0; vendor2\bar\ext::$state = 0;