Author: kn
Date: Thu Oct  4 10:58:39 2007
New Revision: 6355

Log:
- Fixed delete error handling in memory backend, too

Modified:
    trunk/Webdav/src/backends/memory.php
    trunk/Webdav/tests/backend_memory_test.php

Modified: trunk/Webdav/src/backends/memory.php
==============================================================================
--- trunk/Webdav/src/backends/memory.php [iso-8859-1] (original)
+++ trunk/Webdav/src/backends/memory.php [iso-8859-1] Thu Oct  4 10:58:39 2007
@@ -587,14 +587,13 @@
     /**
      * Delete everything below this path.
      *
-     * Returns false if the delete process failed.
-     * 
-     * @param string $path 
-     * @return array(ezcWebdavErrorResponse)
+     * Returns an error response if the deletion failed, and null on success.
+     * 
+     * @param string $path 
+     * @return ezcWebdavErrorResponse
      */
     protected function performDelete( $path )
     {
-        $errors = array();
         // Remove all content nodes starting with requested path
         foreach ( $this->content as $name => $content )
         {
@@ -603,7 +602,7 @@
                 // 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(
+                    return new ezcWebdavErrorResponse(
                         ezcWebdavResponse::STATUS_423,
                         $name
                     );
@@ -616,11 +615,6 @@
             }
         }
 
-        if ( count( $errors ) > 0 ) 
-        {
-            return $errors;
-        }
-
         // Remove parent node assignement to removed node
         $id = array_search( $path, $this->content[$parent = dirname( $path )] 
);
         if ( $id !== false )
@@ -629,7 +623,7 @@
             $this->content[$parent] = array_values( $this->content[$parent] );
         }
 
-        return $errors;
+        return null;
     }
 
     /**

Modified: trunk/Webdav/tests/backend_memory_test.php
==============================================================================
--- trunk/Webdav/tests/backend_memory_test.php [iso-8859-1] (original)
+++ trunk/Webdav/tests/backend_memory_test.php [iso-8859-1] Thu Oct  4 10:58:39 
2007
@@ -1324,13 +1324,9 @@
         $response = $backend->delete( $request );
 
         $this->assertEquals(
-            new ezcWebdavMultistatusResponse(
-                array(
-                    new ezcWebdavErrorResponse(
-                        ezcWebdavResponse::STATUS_423,
-                        '/foo'
-                    ),
-                )
+            new ezcWebdavErrorResponse(
+                ezcWebdavResponse::STATUS_423,
+                '/foo'
             ),
             $response,
             'Expected response does not match real response.',


-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to