"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/Sabre/CalDAV/ValidateICalTest.php" between
dav-4.0.2.tar.gz and dav-4.0.3.tar.gz

About: sabre/dav is a WebDAV framework for PHP allowing to create WebDAV, CalDAV and CardDAV servers.

ValidateICalTest.php  (dav-4.0.2):ValidateICalTest.php  (dav-4.0.3)
skipping to change at line 103 skipping to change at line 103
DTSTAMP:20160406T052348Z DTSTAMP:20160406T052348Z
DTSTART:20160706T140000Z DTSTART:20160706T140000Z
END:VEVENT END:VEVENT
END:VCALENDAR END:VCALENDAR
ICS; ICS;
$request->setBody($ics); $request->setBody($ics);
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
'ETag' => ['"'.md5($ics).'"'], 'ETag' => ['"'.md5($ics).'"'],
], $response->getHeaders()); ], $response->getHeaders());
$expected = [ $expected = [
'uri' => 'blabla.ics', 'uri' => 'blabla.ics',
'calendardata' => $ics, 'calendardata' => $ics,
'calendarid' => 'calendar1', 'calendarid' => 'calendar1',
skipping to change at line 143 skipping to change at line 143
DTSTAMP:20160406T052348Z DTSTAMP:20160406T052348Z
DTSTART:20160706T140000Z DTSTART:20160706T140000Z
END:VEVENT END:VEVENT
END:VCALENDAR END:VCALENDAR
ICS; ICS;
$request->setBody($ics); $request->setBody($ics);
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
} }
public function testCreateFileNoVersionFixed() public function testCreateFileNoVersionFixed()
{ {
$request = new HTTP\Request( $request = new HTTP\Request(
'PUT', 'PUT',
'/calendars/admin/calendar1/blabla.ics', '/calendars/admin/calendar1/blabla.ics',
['Prefer' => 'handling=lenient'] ['Prefer' => 'handling=lenient']
); );
skipping to change at line 169 skipping to change at line 169
DTSTAMP:20160406T052348Z DTSTAMP:20160406T052348Z
DTSTART:20160706T140000Z DTSTART:20160706T140000Z
END:VEVENT END:VEVENT
END:VCALENDAR END:VCALENDAR
ICS; ICS;
$request->setBody($ics); $request->setBody($ics);
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
'X-Sabre-Ew-Gross' => ['iCalendar validation warning: VERSION MUST a ppear exactly once in a VCALENDAR component'], 'X-Sabre-Ew-Gross' => ['iCalendar validation warning: VERSION MUST a ppear exactly once in a VCALENDAR component'],
], $response->getHeaders()); ], $response->getHeaders());
$ics = <<<ICS $ics = <<<ICS
BEGIN:VCALENDAR\r BEGIN:VCALENDAR\r
VERSION:2.0\r VERSION:2.0\r
PRODID:foo\r PRODID:foo\r
skipping to change at line 216 skipping to change at line 216
$ics = <<<ICS $ics = <<<ICS
BEGIN:VCALENDAR BEGIN:VCALENDAR
VERSION:2.0 VERSION:2.0
PRODID:foo PRODID:foo
END:VCALENDAR END:VCALENDAR
ICS; ICS;
$request->setBody($ics); $request->setBody($ics);
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
} }
public function testCreateFileNoUID() public function testCreateFileNoUID()
{ {
$request = HTTP\Sapi::createFromServerArray([ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT', 'REQUEST_METHOD' => 'PUT',
'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
]); ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND: VCALENDAR\r\n"); $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND: VCALENDAR\r\n");
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
} }
public function testCreateFileVCard() public function testCreateFileVCard()
{ {
$request = HTTP\Sapi::createFromServerArray([ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT', 'REQUEST_METHOD' => 'PUT',
'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
]); ]);
$request->setBody("BEGIN:VCARD\r\nEND:VCARD\r\n"); $request->setBody("BEGIN:VCARD\r\nEND:VCARD\r\n");
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
} }
public function testCreateFile2Components() public function testCreateFile2Components()
{ {
$request = HTTP\Sapi::createFromServerArray([ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT', 'REQUEST_METHOD' => 'PUT',
'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
]); ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEV ENT\r\nBEGIN:VJOURNAL\r\nUID:foo\r\nEND:VJOURNAL\r\nEND:VCALENDAR\r\n"); $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEV ENT\r\nBEGIN:VJOURNAL\r\nUID:foo\r\nEND:VJOURNAL\r\nEND:VCALENDAR\r\n");
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
} }
public function testCreateFile2UIDS() public function testCreateFile2UIDS()
{ {
$request = HTTP\Sapi::createFromServerArray([ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT', 'REQUEST_METHOD' => 'PUT',
'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
]); ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r \nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nUID:bar\r\nEND:VEVENT \r\nEND:VCALENDAR\r\n"); $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r \nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nUID:bar\r\nEND:VEVENT \r\nEND:VCALENDAR\r\n");
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
} }
public function testCreateFileWrongComponent() public function testCreateFileWrongComponent()
{ {
$request = HTTP\Sapi::createFromServerArray([ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT', 'REQUEST_METHOD' => 'PUT',
'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
]); ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r \nBEGIN:VFREEBUSY\r\nUID:foo\r\nEND:VFREEBUSY\r\nEND:VCALENDAR\r\n"); $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r \nBEGIN:VFREEBUSY\r\nUID:foo\r\nEND:VFREEBUSY\r\nEND:VCALENDAR\r\n");
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
} }
public function testUpdateFile() public function testUpdateFile()
{ {
$this->calBackend->createCalendarObject('calendar1', 'blabla.ics', 'foo' ); $this->calBackend->createCalendarObject('calendar1', 'blabla.ics', 'foo' );
$request = HTTP\Sapi::createFromServerArray([ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT', 'REQUEST_METHOD' => 'PUT',
'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
]); ]);
skipping to change at line 341 skipping to change at line 341
public function testCreateFileInvalidComponent() public function testCreateFileInvalidComponent()
{ {
$request = HTTP\Sapi::createFromServerArray([ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT', 'REQUEST_METHOD' => 'PUT',
'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics', 'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics',
]); ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r \nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r \nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
} }
public function testUpdateFileInvalidComponent() public function testUpdateFileInvalidComponent()
{ {
$this->calBackend->createCalendarObject('calendar2', 'blabla.ics', 'foo' ); $this->calBackend->createCalendarObject('calendar2', 'blabla.ics', 'foo' );
$request = HTTP\Sapi::createFromServerArray([ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT', 'REQUEST_METHOD' => 'PUT',
'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics', 'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics',
]); ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r \nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r \nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
} }
/** /**
* What we are testing here, is if we send in a latin1 character, the * What we are testing here, is if we send in a latin1 character, the
* server should automatically transform this into UTF-8. * server should automatically transform this into UTF-8.
* *
* More importantly. If any transformation happens, the etag must no longer * More importantly. If any transformation happens, the etag must no longer
* be returned by the server. * be returned by the server.
*/ */
public function testCreateFileModified() public function testCreateFileModified()
skipping to change at line 388 skipping to change at line 388
DTSTAMP:20160406T052348Z DTSTAMP:20160406T052348Z
DTSTART:20160706T140000Z DTSTART:20160706T140000Z
END:VEVENT END:VEVENT
END:VCALENDAR END:VCALENDAR
ICS; ICS;
$request->setBody($ics); $request->setBody($ics);
$response = $this->request($request); $response = $this->request($request);
$this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString());
$this->assertNull($response->getHeader('ETag')); $this->assertNull($response->getHeader('ETag'));
} }
} }
 End of changes. 12 change blocks. 
12 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)