diff options
Diffstat (limited to 'tests/lib/CapabilitiesManagerTest.php')
-rw-r--r-- | tests/lib/CapabilitiesManagerTest.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/lib/CapabilitiesManagerTest.php b/tests/lib/CapabilitiesManagerTest.php index 75fbdb8d89f..139940eb306 100644 --- a/tests/lib/CapabilitiesManagerTest.php +++ b/tests/lib/CapabilitiesManagerTest.php @@ -24,6 +24,7 @@ namespace Test; use OC\CapabilitiesManager; use OCP\AppFramework\QueryException; use OCP\Capabilities\ICapability; +use OCP\Capabilities\IPublicCapability; use OCP\ILogger; class CapabilitiesManagerTest extends TestCase { @@ -35,6 +36,7 @@ class CapabilitiesManagerTest extends TestCase { private $logger; public function setUp() { + parent::setUp(); $this->logger = $this->getMockBuilder('OCP\ILogger')->getMock(); $this->manager = new CapabilitiesManager($this->logger); } @@ -60,6 +62,24 @@ class CapabilitiesManagerTest extends TestCase { } /** + * Test a public capabilitie + */ + public function testPublicCapability() { + $this->manager->registerCapability(function() { + return new PublicSimpleCapability1(); + }); + $this->manager->registerCapability(function() { + return new SimpleCapability2(); + }); + $this->manager->registerCapability(function() { + return new SimpleCapability3(); + }); + + $res = $this->manager->getCapabilities(true); + $this->assertEquals(['foo' => 1], $res); + } + + /** * Test that we need something that implents ICapability * @expectedException \InvalidArgumentException * @expectedExceptionMessage The given Capability (Test\NoCapability) does not implement the ICapability interface @@ -160,6 +180,14 @@ class SimpleCapability3 implements ICapability { } } +class PublicSimpleCapability1 implements IPublicCapability { + public function getCapabilities() { + return [ + 'foo' => 1 + ]; + } +} + class NoCapability { public function getCapabilities() { return [ |