Author: ts
Date: Mon Nov 26 12:47:10 2007
New Revision: 6806

Log:
- Minor fix in automatic path factory to always return '/' for the doc root.
- Adjusted test cases to new behaviour of the automatic path factory.

Modified:
    trunk/Webdav/src/path_factories/automatic.php
    trunk/Webdav/tests/path_factory_automatic_test.php

Modified: trunk/Webdav/src/path_factories/automatic.php
==============================================================================
--- trunk/Webdav/src/path_factories/automatic.php [iso-8859-1] (original)
+++ trunk/Webdav/src/path_factories/automatic.php [iso-8859-1] Mon Nov 26 
12:47:10 2007
@@ -118,7 +118,7 @@
             unset( $this->collectionPathes[$path] );
         }
 
-        return ( is_string( $path ) ? $path : '/' );
+        return ( is_string( $path ) && $path !== '' ? $path : '/' );
     }
 
     /**

Modified: trunk/Webdav/tests/path_factory_automatic_test.php
==============================================================================
--- trunk/Webdav/tests/path_factory_automatic_test.php [iso-8859-1] (original)
+++ trunk/Webdav/tests/path_factory_automatic_test.php [iso-8859-1] Mon Nov 26 
12:47:10 2007
@@ -98,7 +98,7 @@
 
         $factory = new ezcWebdavAutomaticPathFactory();
         $this->assertSame(
-            '',
+            '/',
             $factory->parseUriToPath( $_SERVER['REQUEST_URI'] )
         );
     }
@@ -150,7 +150,7 @@
 
         $factory = new ezcWebdavAutomaticPathFactory();
         $this->assertSame(
-            '',
+            '/',
             $factory->parseUriToPath( $_SERVER['REQUEST_URI'] )
         );
     }
@@ -175,12 +175,10 @@
         $_SERVER['REQUEST_URI']         = 
'/path/to/webdav/collection/ressource';
 
         $factory = new ezcWebdavAutomaticPathFactory();
-        try
-        {
-            $factory->parseUriToPath( $_SERVER['REQUEST_URI'] );
-            $this->fail( 'ezcWebdavBrokenRequestUriException expected.' );
-        }
-        catch ( ezcWebdavBrokenRequestUriException $e ) {}
+        $this->assertEquals(
+            '/webdav/collection/ressource',
+            $factory->parseUriToPath( $_SERVER['REQUEST_URI'] )
+        );
     }
 }
 ?>


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to