diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-08-24 15:21:04 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2018-10-08 01:25:20 +0200 |
commit | 1c6f666bbfc46b9092312c81f82a5e0cbe59fc18 (patch) | |
tree | ecb9d6ae2662d28b167574d2533f7917c7c2e20e /tests | |
parent | 4c47ec005f31e10b55af1bec277c6c0d011e4c28 (diff) | |
download | nextcloud-server-1c6f666bbfc46b9092312c81f82a5e0cbe59fc18.tar.gz nextcloud-server-1c6f666bbfc46b9092312c81f82a5e0cbe59fc18.zip |
adjust Calendar resource / room interfaces to use class implementation
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Calendar/Resource/ManagerTest.php | 32 | ||||
-rw-r--r-- | tests/lib/Calendar/Room/ManagerTest.php | 32 |
2 files changed, 50 insertions, 14 deletions
diff --git a/tests/lib/Calendar/Resource/ManagerTest.php b/tests/lib/Calendar/Resource/ManagerTest.php index ccc6bbf182b..fb1c1435d0f 100644 --- a/tests/lib/Calendar/Resource/ManagerTest.php +++ b/tests/lib/Calendar/Resource/ManagerTest.php @@ -41,18 +41,24 @@ class ManagerTest extends TestCase { public function testRegisterUnregisterBackend() { $backend1 = $this->createMock(IBackend::class); $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + \OC::$server->registerService('calendar_resource_backend1', function () use ($backend1) { + return $backend1; + }); $backend2 = $this->createMock(IBackend::class); $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + \OC::$server->registerService('calendar_resource_backend2', function () use ($backend2) { + return $backend2; + }); - $this->manager->registerBackend($backend1); - $this->manager->registerBackend($backend2); + $this->manager->registerBackend('calendar_resource_backend1'); + $this->manager->registerBackend('calendar_resource_backend2'); $this->assertEquals([ $backend1, $backend2 ], $this->manager->getBackends()); - $this->manager->unregisterBackend($backend1); + $this->manager->unregisterBackend('calendar_resource_backend1'); $this->assertEquals([ $backend2 @@ -62,12 +68,18 @@ class ManagerTest extends TestCase { public function testGetBackend() { $backend1 = $this->createMock(IBackend::class); $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + \OC::$server->registerService('calendar_resource_backend1', function () use ($backend1) { + return $backend1; + }); $backend2 = $this->createMock(IBackend::class); $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + \OC::$server->registerService('calendar_resource_backend2', function () use ($backend2) { + return $backend2; + }); - $this->manager->registerBackend($backend1); - $this->manager->registerBackend($backend2); + $this->manager->registerBackend('calendar_resource_backend1'); + $this->manager->registerBackend('calendar_resource_backend2'); $this->assertEquals($backend1, $this->manager->getBackend('backend_1')); $this->assertEquals($backend2, $this->manager->getBackend('backend_2')); @@ -76,12 +88,18 @@ class ManagerTest extends TestCase { public function testClear() { $backend1 = $this->createMock(IBackend::class); $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + \OC::$server->registerService('calendar_resource_backend1', function () use ($backend1) { + return $backend1; + }); $backend2 = $this->createMock(IBackend::class); $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + \OC::$server->registerService('calendar_resource_backend2', function () use ($backend2) { + return $backend2; + }); - $this->manager->registerBackend($backend1); - $this->manager->registerBackend($backend2); + $this->manager->registerBackend('calendar_resource_backend1'); + $this->manager->registerBackend('calendar_resource_backend2'); $this->assertEquals([ $backend1, $backend2 diff --git a/tests/lib/Calendar/Room/ManagerTest.php b/tests/lib/Calendar/Room/ManagerTest.php index 34d69d127e2..eaa22f9930d 100644 --- a/tests/lib/Calendar/Room/ManagerTest.php +++ b/tests/lib/Calendar/Room/ManagerTest.php @@ -41,18 +41,24 @@ class ManagerTest extends TestCase { public function testRegisterUnregisterBackend() { $backend1 = $this->createMock(IBackend::class); $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + \OC::$server->registerService('calendar_room_backend1', function () use ($backend1) { + return $backend1; + }); $backend2 = $this->createMock(IBackend::class); $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + \OC::$server->registerService('calendar_room_backend2', function () use ($backend2) { + return $backend2; + }); - $this->manager->registerBackend($backend1); - $this->manager->registerBackend($backend2); + $this->manager->registerBackend('calendar_room_backend1'); + $this->manager->registerBackend('calendar_room_backend2'); $this->assertEquals([ $backend1, $backend2 ], $this->manager->getBackends()); - $this->manager->unregisterBackend($backend1); + $this->manager->unregisterBackend('calendar_room_backend1'); $this->assertEquals([ $backend2 @@ -62,12 +68,18 @@ class ManagerTest extends TestCase { public function testGetBackend() { $backend1 = $this->createMock(IBackend::class); $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + \OC::$server->registerService('calendar_room_backend1', function () use ($backend1) { + return $backend1; + }); $backend2 = $this->createMock(IBackend::class); $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + \OC::$server->registerService('calendar_room_backend2', function () use ($backend2) { + return $backend2; + }); - $this->manager->registerBackend($backend1); - $this->manager->registerBackend($backend2); + $this->manager->registerBackend('calendar_room_backend1'); + $this->manager->registerBackend('calendar_room_backend2'); $this->assertEquals($backend1, $this->manager->getBackend('backend_1')); $this->assertEquals($backend2, $this->manager->getBackend('backend_2')); @@ -76,12 +88,18 @@ class ManagerTest extends TestCase { public function testClear() { $backend1 = $this->createMock(IBackend::class); $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + \OC::$server->registerService('calendar_room_backend1', function () use ($backend1) { + return $backend1; + }); $backend2 = $this->createMock(IBackend::class); $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + \OC::$server->registerService('calendar_room_backend2', function () use ($backend2) { + return $backend2; + }); - $this->manager->registerBackend($backend1); - $this->manager->registerBackend($backend2); + $this->manager->registerBackend('calendar_room_backend1'); + $this->manager->registerBackend('calendar_room_backend2'); $this->assertEquals([ $backend1, $backend2 |