From 66effbfe0827fc61fff6d248797a894213ad20d6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 28 May 2016 17:46:24 +0200 Subject: upgrade to sabre32 --- .../dav/tests/Sabre/CalDAV/CalendarObjectTest.php | 166 ++++++++++----------- 1 file changed, 77 insertions(+), 89 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php') 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 @@ 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()); } -- cgit v1.2.3