1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-25 02:51:35 +02:00

Merge pull request #2669 from Nicofuma/ticket/12777

[ticket/12777] Rename extension status functions and add is_configured()

* Nicofuma/ticket/12777:
  [ticket/12777] Add tests for unavailable extension
  [ticket/12777] Add tests
  [ticket/12777] Add is_purged()
  [ticket/12777] Update doc block of is_configured()
  [ticket/12777] Rename extension status functions and add is_configured()
This commit is contained in:
Joas Schilling
2014-06-29 23:33:47 +02:00
6 changed files with 92 additions and 14 deletions

View File

@@ -32,22 +32,62 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$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.
$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()));
}
public function test_configured()
public function test_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'));
$this->assertSame(false, $this->extension_manager->is_enabled('bertie/worlddominationplan'));
}
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'));
$this->assertSame(false, $this->extension_manager->is_disabled('bertie/worlddominationplan'));
}
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'));
$this->assertSame(false, $this->extension_manager->is_purged('bertie/worlddominationplan'));
}
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'));
$this->assertSame(false, $this->extension_manager->is_configured('bertie/worlddominationplan'));
}
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'));
$this->assertSame(false, $this->extension_manager->is_available('bertie/worlddominationplan'));
}
public function test_enable()
{
vendor2\bar\ext::$state = 0;