diff options
author | hubzilla <git@macgirvin.com> | 2016-06-30 09:34:22 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-30 09:34:22 +1000 |
commit | 05aba0b4dd9ce5798e2c8bb57900b03ae96a233e (patch) | |
tree | 0910b2128981452a1c61ba6b6b4683dc51568027 /vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php | |
parent | f098600c41553bc47267a61fb47a4957046e696e (diff) | |
parent | 3102440d407fe195878b9535aae4fd0da750f437 (diff) | |
download | volse-hubzilla-05aba0b4dd9ce5798e2c8bb57900b03ae96a233e.tar.gz volse-hubzilla-05aba0b4dd9ce5798e2c8bb57900b03ae96a233e.tar.bz2 volse-hubzilla-05aba0b4dd9ce5798e2c8bb57900b03ae96a233e.zip |
Merge pull request #444 from git-marijus/dev
Merge branch sabre32 into dev
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php | 166 |
1 files changed, 77 insertions, 89 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php index 9fc1eee4c..0d98922ff 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php @@ -1,7 +1,6 @@ <?php namespace Sabre\CalDAV; -use Sabre\DAVACL; require_once 'Sabre/CalDAV/TestUtil.php'; @@ -19,11 +18,10 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { function setup() { - if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available'); $this->backend = TestUtil::getBackend(); $calendars = $this->backend->getCalendarsForUser('principals/user1'); - $this->assertEquals(2,count($calendars)); + $this->assertEquals(2, count($calendars)); $this->calendar = new Calendar($this->backend, $calendars[0]); } @@ -40,10 +38,10 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); - $this->assertInternalType('string',$children[0]->getName()); - $this->assertInternalType('string',$children[0]->get()); - $this->assertInternalType('string',$children[0]->getETag()); - $this->assertEquals('text/calendar; charset=utf-8; component=vevent', $children[0]->getContentType()); + $this->assertInternalType('string', $children[0]->getName()); + $this->assertInternalType('string', $children[0]->get()); + $this->assertInternalType('string', $children[0]->getETag()); + $this->assertEquals('text/calendar; charset=utf-8', $children[0]->getContentType()); } @@ -53,9 +51,9 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { function testInvalidArg1() { $obj = new CalendarObject( - new Backend\Mock(array(),array()), - array(), - array() + new Backend\Mock([], []), + [], + [] ); } @@ -66,9 +64,9 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { function testInvalidArg2() { $obj = new CalendarObject( - new Backend\Mock(array(),array()), - array(), - array('calendarid' => '1') + new Backend\Mock([], []), + [], + ['calendarid' => '1'] ); } @@ -96,7 +94,7 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $this->assertTrue($children[0] instanceof CalendarObject); $newData = TestUtil::getTestCalendarData(); - $stream = fopen('php://temp','r+'); + $stream = fopen('php://temp', 'r+'); fwrite($stream, $newData); rewind($stream); $children[0]->put($stream); @@ -117,7 +115,7 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $obj->delete(); $children2 = $this->calendar->getChildren(); - $this->assertEquals(count($children)-1, count($children2)); + $this->assertEquals(count($children) - 1, count($children2)); } @@ -132,7 +130,7 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $obj = $children[0]; $lastMod = $obj->getLastModified(); - $this->assertTrue(is_int($lastMod) || ctype_digit($lastMod)); + $this->assertTrue(is_int($lastMod) || ctype_digit($lastMod) || is_null($lastMod)); } @@ -173,33 +171,33 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { function testGetACL() { - $expected = array( - array( + $expected = [ + [ 'privilege' => '{DAV:}read', 'principal' => 'principals/user1', 'protected' => true, - ), - array( + ], + [ 'privilege' => '{DAV:}read', 'principal' => 'principals/user1/calendar-proxy-write', 'protected' => true, - ), - array( + ], + [ 'privilege' => '{DAV:}read', 'principal' => 'principals/user1/calendar-proxy-read', 'protected' => true, - ), - array( + ], + [ 'privilege' => '{DAV:}write', 'principal' => 'principals/user1', 'protected' => true, - ), - array( + ], + [ 'privilege' => '{DAV:}write', 'principal' => 'principals/user1/calendar-proxy-write', 'protected' => true, - ), - ); + ], + ]; $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); @@ -213,40 +211,30 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $backend = new Backend\Mock([], []); $calendarObject = new CalendarObject($backend, ['principaluri' => 'principals/user1'], ['calendarid' => 1, 'uri' => 'foo']); - $expected = array( - array( - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1', - 'protected' => true, - ), - array( - 'privilege' => '{DAV:}write', + $expected = [ + [ + 'privilege' => '{DAV:}all', 'principal' => 'principals/user1', 'protected' => true, - ), - array( - 'privilege' => '{DAV:}read', + ], + [ + 'privilege' => '{DAV:}all', 'principal' => 'principals/user1/calendar-proxy-write', 'protected' => true, - ), - array( - 'privilege' => '{DAV:}write', - 'principal' => 'principals/user1/calendar-proxy-write', - 'protected' => true, - ), - array( + ], + [ 'privilege' => '{DAV:}read', 'principal' => 'principals/user1/calendar-proxy-read', 'protected' => true, - ), - ); + ], + ]; $this->assertEquals($expected, $calendarObject->getACL()); } /** - * @expectedException Sabre\DAV\Exception\MethodNotAllowed + * @expectedException \Sabre\DAV\Exception\Forbidden */ function testSetACL() { @@ -254,7 +242,7 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $this->assertTrue($children[0] instanceof CalendarObject); $obj = $children[0]; - $obj->setACL(array()); + $obj->setACL([]); } @@ -306,15 +294,15 @@ END:VCALENDAR"; function testGetRefetch() { - $backend = new Backend\Mock(array(), array( - 1 => array( - 'foo' => array( + $backend = new Backend\Mock([], [ + 1 => [ + 'foo' => [ 'calendardata' => 'foo', - 'uri' => 'foo' - ), - ) - )); - $obj = new CalendarObject($backend, array('id' => 1), array('uri' => 'foo')); + 'uri' => 'foo' + ], + ] + ]); + $obj = new CalendarObject($backend, ['id' => 1], ['uri' => 'foo']); $this->assertEquals('foo', $obj->get()); @@ -322,15 +310,15 @@ END:VCALENDAR"; function testGetEtag1() { - $objectInfo = array( + $objectInfo = [ 'calendardata' => 'foo', - 'uri' => 'foo', - 'etag' => 'bar', - 'calendarid' => 1 - ); + 'uri' => 'foo', + 'etag' => 'bar', + 'calendarid' => 1 + ]; - $backend = new Backend\Mock(array(), array()); - $obj = new CalendarObject($backend, array(), $objectInfo); + $backend = new Backend\Mock([], []); + $obj = new CalendarObject($backend, [], $objectInfo); $this->assertEquals('bar', $obj->getETag()); @@ -338,14 +326,14 @@ END:VCALENDAR"; function testGetEtag2() { - $objectInfo = array( + $objectInfo = [ 'calendardata' => 'foo', - 'uri' => 'foo', - 'calendarid' => 1 - ); + 'uri' => 'foo', + 'calendarid' => 1 + ]; - $backend = new Backend\Mock(array(), array()); - $obj = new CalendarObject($backend, array(), $objectInfo); + $backend = new Backend\Mock([], []); + $obj = new CalendarObject($backend, [], $objectInfo); $this->assertEquals('"' . md5('foo') . '"', $obj->getETag()); @@ -353,42 +341,42 @@ END:VCALENDAR"; function testGetSupportedPrivilegesSet() { - $objectInfo = array( + $objectInfo = [ 'calendardata' => 'foo', - 'uri' => 'foo', - 'calendarid' => 1 - ); + 'uri' => 'foo', + 'calendarid' => 1 + ]; - $backend = new Backend\Mock(array(), array()); - $obj = new CalendarObject($backend, array(), $objectInfo); + $backend = new Backend\Mock([], []); + $obj = new CalendarObject($backend, [], $objectInfo); $this->assertNull($obj->getSupportedPrivilegeSet()); } function testGetSize1() { - $objectInfo = array( + $objectInfo = [ 'calendardata' => 'foo', - 'uri' => 'foo', - 'calendarid' => 1 - ); + 'uri' => 'foo', + 'calendarid' => 1 + ]; - $backend = new Backend\Mock(array(), array()); - $obj = new CalendarObject($backend, array(), $objectInfo); + $backend = new Backend\Mock([], []); + $obj = new CalendarObject($backend, [], $objectInfo); $this->assertEquals(3, $obj->getSize()); } function testGetSize2() { - $objectInfo = array( - 'uri' => 'foo', + $objectInfo = [ + 'uri' => 'foo', 'calendarid' => 1, - 'size' => 4, - ); + 'size' => 4, + ]; - $backend = new Backend\Mock(array(), array()); - $obj = new CalendarObject($backend, array(), $objectInfo); + $backend = new Backend\Mock([], []); + $obj = new CalendarObject($backend, [], $objectInfo); $this->assertEquals(4, $obj->getSize()); } |