"Fossies" - the Fresh Open Source Software Archive  

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

PrincipalPropertySearchTest.php  (dav-4.0.2):PrincipalPropertySearchTest.php  (dav-4.0.3)
skipping to change at line 143 skipping to change at line 143
]; ];
$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(207, $server->httpResponse->status, $server->httpRes $bodyAsString = $server->httpResponse->getBodyAsString();
ponse->body); $this->assertEquals(207, $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'],
'Vary' => ['Brief,Prefer'], 'Vary' => ['Brief,Prefer'],
], $server->httpResponse->getHeaders()); ], $server->httpResponse->getHeaders());
$check = [ $check = [
'/d:multistatus', '/d:multistatus',
'/d:multistatus/d:response' => 2, '/d:multistatus/d:response' => 2,
'/d:multistatus/d:response/d:href' => 2, '/d:multistatus/d:response/d:href' => 2,
'/d:multistatus/d:response/d:propstat' => 4, '/d:multistatus/d:response/d:propstat' => 4,
'/d:multistatus/d:response/d:propstat/d:prop' => 4, '/d:multistatus/d:response/d:propstat/d:prop' => 4,
'/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 2, '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 2,
'/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 2, '/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 2,
'/d:multistatus/d:response/d:propstat/d:status' => 4, '/d:multistatus/d:response/d:propstat/d:status' => 4,
]; ];
$xml = simplexml_load_string($server->httpResponse->body); $xml = simplexml_load_string($bodyAsString);
$xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('d', 'DAV:');
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: '.$ server->httpResponse->getBodyAsString());
} }
} }
public function testAND() public function testAND()
{ {
$xml = '<?xml version="1.0"?> $xml = '<?xml version="1.0"?>
<d:principal-property-search xmlns:d="DAV:"> <d:principal-property-search xmlns:d="DAV:">
<d:apply-to-principal-collection-set /> <d:apply-to-principal-collection-set />
<d:property-search> <d:property-search>
<d:prop> <d:prop>
skipping to change at line 214 skipping to change at line 215
]; ];
$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(207, $server->httpResponse->status, $server->httpRes $bodyAsString = $server->httpResponse->getBodyAsString();
ponse->body); $this->assertEquals(207, $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'],
'Vary' => ['Brief,Prefer'], 'Vary' => ['Brief,Prefer'],
], $server->httpResponse->getHeaders()); ], $server->httpResponse->getHeaders());
$check = [ $check = [
'/d:multistatus', '/d:multistatus',
'/d:multistatus/d:response' => 0, '/d:multistatus/d:response' => 0,
'/d:multistatus/d:response/d:href' => 0, '/d:multistatus/d:response/d:href' => 0,
'/d:multistatus/d:response/d:propstat' => 0, '/d:multistatus/d:response/d:propstat' => 0,
'/d:multistatus/d:response/d:propstat/d:prop' => 0, '/d:multistatus/d:response/d:propstat/d:prop' => 0,
'/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 0, '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 0,
'/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 0, '/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 0,
'/d:multistatus/d:response/d:propstat/d:status' => 0, '/d:multistatus/d:response/d:propstat/d:status' => 0,
]; ];
$xml = simplexml_load_string($server->httpResponse->body); $xml = simplexml_load_string($bodyAsString);
$xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('d', 'DAV:');
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: '.$ server->httpResponse->getBodyAsString());
} }
} }
public function testOR() public function testOR()
{ {
$xml = '<?xml version="1.0"?> $xml = '<?xml version="1.0"?>
<d:principal-property-search xmlns:d="DAV:" test="anyof"> <d:principal-property-search xmlns:d="DAV:" test="anyof">
<d:apply-to-principal-collection-set /> <d:apply-to-principal-collection-set />
<d:property-search> <d:property-search>
<d:prop> <d:prop>
skipping to change at line 285 skipping to change at line 287
]; ];
$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(207, $server->httpResponse->status, $server->httpRes $bodyAsString = $server->httpResponse->getBodyAsString();
ponse->body); $this->assertEquals(207, $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'],
'Vary' => ['Brief,Prefer'], 'Vary' => ['Brief,Prefer'],
], $server->httpResponse->getHeaders()); ], $server->httpResponse->getHeaders());
$check = [ $check = [
'/d:multistatus', '/d:multistatus',
'/d:multistatus/d:response' => 2, '/d:multistatus/d:response' => 2,
'/d:multistatus/d:response/d:href' => 2, '/d:multistatus/d:response/d:href' => 2,
'/d:multistatus/d:response/d:propstat' => 4, '/d:multistatus/d:response/d:propstat' => 4,
'/d:multistatus/d:response/d:propstat/d:prop' => 4, '/d:multistatus/d:response/d:propstat/d:prop' => 4,
'/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 2, '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 2,
'/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 2, '/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 2,
'/d:multistatus/d:response/d:propstat/d:status' => 4, '/d:multistatus/d:response/d:propstat/d:status' => 4,
]; ];
$xml = simplexml_load_string($server->httpResponse->body); $xml = simplexml_load_string($bodyAsString);
$xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('d', 'DAV:');
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: '.$ server->httpResponse->getBodyAsString());
} }
} }
public function testWrongUri() public function testWrongUri()
{ {
$xml = '<?xml version="1.0"?> $xml = '<?xml version="1.0"?>
<d:principal-property-search xmlns:d="DAV:"> <d:principal-property-search xmlns:d="DAV:">
<d:property-search> <d:property-search>
<d:prop> <d:prop>
<d:displayname /> <d:displayname />
skipping to change at line 349 skipping to change at line 352
]; ];
$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(207, $server->httpResponse->status, $server->httpRes $bodyAsString = $server->httpResponse->getBodyAsString();
ponse->body); $this->assertEquals(207, $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'],
'Vary' => ['Brief,Prefer'], 'Vary' => ['Brief,Prefer'],
], $server->httpResponse->getHeaders()); ], $server->httpResponse->getHeaders());
$check = [ $check = [
'/d:multistatus', '/d:multistatus',
'/d:multistatus/d:response' => 0, '/d:multistatus/d:response' => 0,
]; ];
$xml = simplexml_load_string($server->httpResponse->body); $xml = simplexml_load_string($bodyAsString);
$xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('d', 'DAV:');
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: '.$ server->httpResponse->getBodyAsString());
} }
} }
} }
class MockPlugin extends Plugin class MockPlugin extends Plugin
{ {
public function getCurrentUserPrivilegeSet($node) public function getCurrentUserPrivilegeSet($node)
{ {
return [ return [
'{DAV:}read', '{DAV:}read',
 End of changes. 12 change blocks. 
16 lines changed or deleted 16 lines changed or added

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