diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-08-14 19:08:01 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-09-26 11:55:41 +0200 |
commit | f0421e1f75179a42e76973a4b11d8474ee571d08 (patch) | |
tree | 7bfc35ef736b4e57ee8b36a3ddf6fe5e686d983d /apps/dav/tests/unit | |
parent | f16ea48e96885e8bdff8fc66f6923232b32a407c (diff) | |
download | nextcloud-server-f0421e1f75179a42e76973a4b11d8474ee571d08.tar.gz nextcloud-server-f0421e1f75179a42e76973a4b11d8474ee571d08.zip |
add missing tests
Diffstat (limited to 'apps/dav/tests/unit')
-rw-r--r-- | apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php | 6 | ||||
-rw-r--r-- | apps/dav/tests/unit/CalDAV/CalDavBackendTest.php | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php index ebdd4d9f940..ca5000f3f44 100644 --- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php @@ -28,6 +28,7 @@ use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CalDAV\Calendar; use OCA\DAV\Connector\Sabre\Principal; use OCP\IL10N; +use OCP\IConfig; use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet; use Sabre\DAV\PropPatch; use Sabre\DAV\Xml\Property\Href; @@ -51,6 +52,9 @@ abstract class AbstractCalDavBackendTest extends TestCase { /** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject */ protected $userManager; + + /** var OCP\IConfig */ + protected $config; const UNIT_TEST_USER = 'principals/users/caldav-unit-test'; const UNIT_TEST_USER1 = 'principals/users/caldav-unit-test1'; @@ -75,7 +79,7 @@ abstract class AbstractCalDavBackendTest extends TestCase { ->willReturn([self::UNIT_TEST_GROUP]); $db = \OC::$server->getDatabaseConnection(); - $config = \OC::$server->getConfig(); + $this->config = \OC::$server->getConfig(); $this->backend = new CalDavBackend($db, $this->principal, $this->userManager, $config); $this->tearDown(); diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index a597b476336..0c07ed7c292 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -343,13 +343,24 @@ EOD; ->disableOriginalConstructor()->getMock(); $calendar = new Calendar($this->backend, $calendarInfo, $l10n); - $this->backend->setPublishStatus(true, $calendar); - $this->assertEquals(true, $this->backend->getPublishStatus($calendar)); + $calendar->setPublishStatus(true); + $this->assertEquals(true, $calendar->getPublishStatus()); $publicCalendars = $this->backend->getPublicCalendars(); $this->assertEquals(1, count($publicCalendars)); $this->assertEquals(true, $publicCalendars[0]['{http://owncloud.org/ns}public']); + $publicCalendarURI = md5($this->config->getSystemValue('secret', '') . $calendar->getResourceId()); + $publicCalendar = $this->backend->getPublicCalendar($publicCalendarURI); + $this->assertEquals(true, $publicCalendar['{http://owncloud.org/ns}public']); + + $calendar->setPublishStatus(false); + $this->assertEquals(false, $calendar->getPublishStatus()); + + $publicCalendarURI = md5($this->config->getSystemValue('secret', '') . $calendar->getResourceId()); + $this->setExpectedException('Sabre\DAV\Exception\NotFound'); + $publicCalendar = $this->backend->getPublicCalendar($publicCalendarURI); + } public function testSubscriptions() { |