"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.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.

PrincipalSearchPropertySetTest.php  (dav-4.0.2):PrincipalSearchPropertySetTest.php  (dav-4.0.3)
skipping to change at line 79 skipping to change at line 79
]; ];
$request = HTTP\Sapi::createFromServerArray($serverVars); $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml); $request->setBody($xml);
$server = $this->getServer(); $server = $this->getServer();
$server->httpRequest = $request; $server->httpRequest = $request;
$server->exec(); $server->exec();
$this->assertEquals(400, $server->httpResponse->status, $server->httpRes ponse->body); $this->assertEquals(400, $server->httpResponse->status, $server->httpRes ponse->getBodyAsString());
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Type' => ['application/xml; charset=utf-8'], 'Content-Type' => ['application/xml; charset=utf-8'],
], $server->httpResponse->getHeaders()); ], $server->httpResponse->getHeaders());
} }
public function testCorrect() public function testCorrect()
{ {
$xml = '<?xml version="1.0"?> $xml = '<?xml version="1.0"?>
<d:principal-search-property-set xmlns:d="DAV:"/>'; <d:principal-search-property-set xmlns:d="DAV:"/>';
skipping to change at line 105 skipping to change at line 105
]; ];
$request = HTTP\Sapi::createFromServerArray($serverVars); $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml); $request->setBody($xml);
$server = $this->getServer(); $server = $this->getServer();
$server->httpRequest = $request; $server->httpRequest = $request;
$server->exec(); $server->exec();
$this->assertEquals(200, $server->httpResponse->status, $server->httpRes $bodyAsString = $server->httpResponse->getBodyAsString();
ponse->body); $this->assertEquals(200, $server->httpResponse->status, $bodyAsString);
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Type' => ['application/xml; charset=utf-8'], 'Content-Type' => ['application/xml; charset=utf-8'],
], $server->httpResponse->getHeaders()); ], $server->httpResponse->getHeaders());
$check = [ $check = [
'/d:principal-search-property-set', '/d:principal-search-property-set',
'/d:principal-search-property-set/d:principal-search-property' => 2, '/d:principal-search-property-set/d:principal-search-property' => 2,
'/d:principal-search-property-set/d:principal-search-property/d:prop ' => 2, '/d:principal-search-property-set/d:principal-search-property/d:prop ' => 2,
'/d:principal-search-property-set/d:principal-search-property/d:prop /d:displayname' => 1, '/d:principal-search-property-set/d:principal-search-property/d:prop /d:displayname' => 1,
'/d:principal-search-property-set/d:principal-search-property/d:prop /s:email-address' => 1, '/d:principal-search-property-set/d:principal-search-property/d:prop /s:email-address' => 1,
'/d:principal-search-property-set/d:principal-search-property/d:desc ription' => 2, '/d:principal-search-property-set/d:principal-search-property/d:desc ription' => 2,
]; ];
$xml = simplexml_load_string($server->httpResponse->body); $xml = simplexml_load_string($bodyAsString);
$xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('d', 'DAV:');
$xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns');
foreach ($check as $v1 => $v2) { foreach ($check as $v1 => $v2) {
$xpath = is_int($v1) ? $v2 : $v1; $xpath = is_int($v1) ? $v2 : $v1;
$result = $xml->xpath($xpath); $result = $xml->xpath($xpath);
$count = 1; $count = 1;
if (!is_int($v1)) { if (!is_int($v1)) {
$count = $v2; $count = $v2;
} }
$this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$ server->httpResponse->body); $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$ bodyAsString);
} }
} }
} }
 End of changes. 4 change blocks. 
5 lines changed or deleted 5 lines changed or added

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