aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php102
1 files changed, 27 insertions, 75 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php
index 324788d4a..5e99f2e73 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php
@@ -12,23 +12,24 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
function getServer() {
$tree = array(
- new MockPropertyNode('node1', array(
+ new DAV\Mock\PropertiesCollection('node1', [], array(
'{http://sabredav.org/ns}simple' => 'foo',
- '{http://sabredav.org/ns}href' => new DAV\Property\Href('node2'),
+ '{http://sabredav.org/ns}href' => new DAV\Xml\Property\Href('node2'),
'{DAV:}displayname' => 'Node 1',
)),
- new MockPropertyNode('node2', array(
+ new DAV\Mock\PropertiesCollection('node2', [], array(
'{http://sabredav.org/ns}simple' => 'simple',
- '{http://sabredav.org/ns}hreflist' => new DAV\Property\HrefList(array('node1','node3')),
+ '{http://sabredav.org/ns}hreflist' => new DAV\Xml\Property\Href(['node1','node3']),
'{DAV:}displayname' => 'Node 2',
)),
- new MockPropertyNode('node3', array(
+ new DAV\Mock\PropertiesCollection('node3', [], array(
'{http://sabredav.org/ns}simple' => 'simple',
'{DAV:}displayname' => 'Node 3',
)),
);
$fakeServer = new DAV\Server($tree);
+ $fakeServer->sapi = new HTTP\SapiMock();
$fakeServer->debugExceptions = true;
$fakeServer->httpResponse = new HTTP\ResponseMock();
$plugin = new Plugin();
@@ -58,7 +59,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/node1',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -66,10 +67,11 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status,'Incorrect status code received. Full body: ' . $server->httpResponse->body);
+ $this->assertEquals(207, $server->httpResponse->status,'Incorrect status code received. Full body: ' . $server->httpResponse->body);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
$check = array(
@@ -120,7 +122,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/node1',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -128,10 +130,11 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status, 'Incorrect response status received. Full response body: ' . $server->httpResponse->body);
+ $this->assertEquals(207, $server->httpResponse->status, 'Incorrect response status received. Full response body: ' . $server->httpResponse->body);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
$check = array(
@@ -160,7 +163,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$count = 1;
if (!is_int($v1)) $count = $v2;
- $this->assertEquals($count,count($result), 'we expected ' . $count . ' appearances of ' . $xpath . ' . We found ' . count($result));
+ $this->assertEquals($count,count($result), 'we expected ' . $count . ' appearances of ' . $xpath . ' . We found ' . count($result) . ' Full response body: ' . $server->httpResponse->getBodyAsString());
}
@@ -184,7 +187,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/node2',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -192,10 +195,11 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status);
+ $this->assertEquals(207, $server->httpResponse->status);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
$check = array(
@@ -251,7 +255,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/node2',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -259,10 +263,11 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status);
+ $this->assertEquals(207, $server->httpResponse->status);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
$check = array(
@@ -303,56 +308,3 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
}
}
-class MockPropertyNode implements DAV\INode, DAV\IProperties {
-
- function __construct($name, array $properties) {
-
- $this->name = $name;
- $this->properties = $properties;
-
- }
-
- function getName() {
-
- return $this->name;
-
- }
-
- function getProperties($requestedProperties) {
-
- $returnedProperties = array();
- foreach($requestedProperties as $requestedProperty) {
- if (isset($this->properties[$requestedProperty])) {
- $returnedProperties[$requestedProperty] =
- $this->properties[$requestedProperty];
- }
- }
- return $returnedProperties;
-
- }
-
- function delete() {
-
- throw new DAV\Exception('Not implemented');
-
- }
-
- function setName($name) {
-
- throw new DAV\Exception('Not implemented');
-
- }
-
- function getLastModified() {
-
- return null;
-
- }
-
- function updateProperties($properties) {
-
- throw new DAV\Exception('Not implemented');
-
- }
-
-}