Author: ts
Date: Tue Sep 25 11:34:08 2007
New Revision: 6262
Log:
- Made DELETE response work.
# Included some case sensitivity and whitespace adjustments in
# tests/clients/rfc/delete/response/body.xml.
Modified:
trunk/Webdav/src/backend/memory.php
trunk/Webdav/src/backend/simple.php
trunk/Webdav/tests/client_test_rfc_backend.php
trunk/Webdav/tests/clients/rfc/delete/response/body.xml
Modified: trunk/Webdav/src/backend/memory.php
==============================================================================
--- trunk/Webdav/src/backend/memory.php [iso-8859-1] (original)
+++ trunk/Webdav/src/backend/memory.php [iso-8859-1] Tue Sep 25 11:34:08 2007
@@ -581,25 +581,28 @@
* Returns false if the delete process failed.
*
* @param string $path
- * @return bool
+ * @return array(ezcWebdavErrorResponse)
*/
protected function performDelete( $path )
{
- // Check if we want to cause some errors here.
- if ( $this->options->failingOperations &
ezcWebdavMemoryBackendOptions::REQUEST_DELETE )
- {
- if ( preg_match( $this->options->failForRegexp, $path ) )
- {
- return false;
- }
- }
-
+ $errors = array();
// Remove all content nodes starting with requested path
foreach ( $this->content as $name => $content )
{
if ( strpos( $name, $path ) === 0 )
{
- unset( $this->content[$name] );
+ // Check if we want to cause some errors here.
+ if ( $this->options->failingOperations &
ezcWebdavMemoryBackendOptions::REQUEST_DELETE && preg_match(
$this->options->failForRegexp, $name ) > 0 )
+ {
+ $errors[] = new ezcWebdavErrorResponse(
+ ezcWebdavResponse::STATUS_423,
+ $name
+ );
+ }
+ else
+ {
+ unset( $this->content[$name] );
+ }
}
}
@@ -620,7 +623,7 @@
}
}
- return true;
+ return $errors;
}
/**
Modified: trunk/Webdav/src/backend/simple.php
==============================================================================
--- trunk/Webdav/src/backend/simple.php [iso-8859-1] (original)
+++ trunk/Webdav/src/backend/simple.php [iso-8859-1] Tue Sep 25 11:34:08 2007
@@ -742,11 +742,10 @@
//
// @TODO: The error generated here should depend on the actual backend
// implementation and not be generated guessing what may fit.
- if ( $deletion !== true )
- {
- return new ezcWebdavErrorResponse(
- ezcWebdavResponse::STATUS_423,
- $source
+ if ( count( $deletion ) > 0 )
+ {
+ return new ezcWebdavMultistatusResponse(
+ $deletion
);
}
@@ -911,7 +910,13 @@
$this->nodeExists( $dest ) )
{
$replaced = true;
- $this->performDelete( $dest );
+ if ( $this->performDelete( $dest ) === false )
+ {
+ return new ezcWebdavErrorResponse(
+ ezcWebdavResponse::STATUS_423,
+ $dest
+ );
+ }
}
// All checks are passed, we can actuall copy now.
Modified: trunk/Webdav/tests/client_test_rfc_backend.php
==============================================================================
--- trunk/Webdav/tests/client_test_rfc_backend.php [iso-8859-1] (original)
+++ trunk/Webdav/tests/client_test_rfc_backend.php [iso-8859-1] Tue Sep 25
11:34:08 2007
@@ -5,7 +5,7 @@
public static function performSetup( ezcWebdavClientTest $test,
$testSetName )
{
$test->transport = new ezcWebdavTransportTestMock();
- $test->transport->options->pathFactory = new ezcWebdavPathFactory(
'http://foo.bar' );
+ $test->transport->options->pathFactory = new ezcWebdavPathFactory(
'http://www.foo.bar' );
switch( $testSetName )
{
@@ -265,7 +265,7 @@
array(
'container' => array(
'front.html' => '',
- 'R2' => array(),
+ 'R2/' => array(),
'resource3' => '',
),
)
Modified: trunk/Webdav/tests/clients/rfc/delete/response/body.xml
==============================================================================
--- trunk/Webdav/tests/clients/rfc/delete/response/body.xml [iso-8859-1]
(original)
+++ trunk/Webdav/tests/clients/rfc/delete/response/body.xml [iso-8859-1] Tue
Sep 25 11:34:08 2007
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<d:multistatus xmlns:d="DAV:">
- <d:response>
- <d:href>http://www.foo.bar/container/resource3</d:href>
- <d:status>HTTP/1.1 423 Locked</d:status>
- </d:response>
-</d:multistatus>
+<?xml version="1.0" encoding="UTF-8" ?>
+<D:multistatus xmlns:D="DAV:">
+ <D:response>
+ <D:href>http://www.foo.bar/container/resource3</D:href>
+ <D:status>HTTP/1.1 423 Locked</D:status>
+ </D:response>
+</D:multistatus>
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components