diff options
author | Anna Larch <anna@nextcloud.com> | 2021-09-27 14:58:16 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-10-14 08:22:24 +0200 |
commit | a58d1e6b06d553927ff6b80822074e640ee66a9c (patch) | |
tree | 27472486e3dd55dca6311e7c9ad131d050156b6d /tests/lib/Calendar | |
parent | b7ee885f930c32ab5412208a0e6cc13650735663 (diff) | |
download | nextcloud-server-a58d1e6b06d553927ff6b80822074e640ee66a9c.tar.gz nextcloud-server-a58d1e6b06d553927ff6b80822074e640ee66a9c.zip |
Add Public Calendar Provider
Signed-off-by: Anna Larch <anna@nextcloud.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Calendar')
-rw-r--r-- | tests/lib/Calendar/ManagerTest.php | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php index e686e82adf0..70f7dbe2437 100644 --- a/tests/lib/Calendar/ManagerTest.php +++ b/tests/lib/Calendar/ManagerTest.php @@ -23,26 +23,35 @@ namespace Test\Calendar; +use OC\AppFramework\Bootstrap\Coordinator; use OC\Calendar\Manager; use OCP\Calendar\ICalendar; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class ManagerTest extends TestCase { + /** @var Coordinator|MockObject */ + private $coordinator; + /** @var Manager */ private $manager; protected function setUp(): void { parent::setUp(); - $this->manager = new Manager(); + $this->coordinator = $this->createMock(Coordinator::class); + + $this->manager = new Manager( + $this->coordinator + ); } /** * @dataProvider searchProvider */ public function testSearch($search1, $search2, $expected) { - /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */ + /** @var ICalendar | MockObject $calendar1 */ $calendar1 = $this->createMock(ICalendar::class); $calendar1->method('getKey')->willReturn('simple:1'); $calendar1->expects($this->once()) @@ -50,7 +59,7 @@ class ManagerTest extends TestCase { ->with('', [], [], null, null) ->willReturn($search1); - /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */ + /** @var ICalendar | MockObject $calendar2 */ $calendar2 = $this->createMock(ICalendar::class); $calendar2->method('getKey')->willReturn('simple:2'); $calendar2->expects($this->once()) @@ -69,7 +78,7 @@ class ManagerTest extends TestCase { * @dataProvider searchProvider */ public function testSearchOptions($search1, $search2, $expected) { - /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */ + /** @var ICalendar | MockObject $calendar1 */ $calendar1 = $this->createMock(ICalendar::class); $calendar1->method('getKey')->willReturn('simple:1'); $calendar1->expects($this->once()) @@ -78,7 +87,7 @@ class ManagerTest extends TestCase { ['timerange' => ['start' => null, 'end' => null]], 5, 20) ->willReturn($search1); - /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */ + /** @var ICalendar | MockObject $calendar2 */ $calendar2 = $this->createMock(ICalendar::class); $calendar2->method('getKey')->willReturn('simple:2'); $calendar2->expects($this->once()) @@ -150,11 +159,11 @@ class ManagerTest extends TestCase { } public function testRegisterUnregister() { - /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */ + /** @var ICalendar | MockObject $calendar1 */ $calendar1 = $this->createMock(ICalendar::class); $calendar1->method('getKey')->willReturn('key1'); - /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */ + /** @var ICalendar | MockObject $calendar2 */ $calendar2 = $this->createMock(ICalendar::class); $calendar2->method('getKey')->willReturn('key2'); @@ -174,11 +183,11 @@ class ManagerTest extends TestCase { } public function testGetCalendars() { - /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */ + /** @var ICalendar | MockObject $calendar1 */ $calendar1 = $this->createMock(ICalendar::class); $calendar1->method('getKey')->willReturn('key1'); - /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */ + /** @var ICalendar | MockObject $calendar2 */ $calendar2 = $this->createMock(ICalendar::class); $calendar2->method('getKey')->willReturn('key2'); @@ -203,7 +212,7 @@ class ManagerTest extends TestCase { } public function testIfEnabledIfSo() { - /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar */ + /** @var ICalendar | MockObject $calendar */ $calendar = $this->createMock(ICalendar::class); $this->manager->registerCalendar($calendar); |