Author: kn
Date: Thu Oct 4 10:34:51 2007
New Revision: 6353
Log:
- Keep properties alive on copy
Modified:
trunk/Webdav/src/backends/file.php
trunk/Webdav/tests/backend_file_test.php
Modified: trunk/Webdav/src/backends/file.php
==============================================================================
--- trunk/Webdav/src/backends/file.php [iso-8859-1] (original)
+++ trunk/Webdav/src/backends/file.php [iso-8859-1] Thu Oct 4 10:34:51 2007
@@ -677,9 +677,13 @@
);
}
- // @TODO: Copy properties
-
- // @TODO: Update live properties if requested
+ // Copy dead properties
+ $storage = $this->getPropertyStorage( $fromPath );
+ $this->storeProperties( $toPath, $storage );
+
+ // Updateable live properties are updated automagically, because they
+ // are regenerated on request on base of the file they affect. So there
+ // is no reason to keep them "alive".
return $errors;
}
Modified: trunk/Webdav/tests/backend_file_test.php
==============================================================================
--- trunk/Webdav/tests/backend_file_test.php [iso-8859-1] (original)
+++ trunk/Webdav/tests/backend_file_test.php [iso-8859-1] Thu Oct 4 10:34:51
2007
@@ -343,6 +343,73 @@
new ezcWebdavCopyResponse(
false
),
+ 'Expected response does not match real response.',
+ 0,
+ 20
+ );
+ }
+
+ public function testResourceCopyProperties()
+ {
+ $backend = new ezcWebdavFileBackend( $this->tempDir . 'backend/' );
+ $backend->options->useMimeExts = false;
+
+ $newProperties = new ezcWebdavFlaggedPropertyStorage();
+ $newProperties->attach(
+ $p1 = new ezcWebdavGetContentTypeProperty( 'text/xml' ),
+ ezcWebdavPropPatchRequest::SET
+ );
+ $newProperties->attach(
+ $p2 = new ezcWebdavDeadProperty( 'foo:', 'bar', "<?xml
version=\"1.0\"?>\n<bar xmlns=\"foo:\">some content</bar>\n" ),
+ ezcWebdavPropPatchRequest::SET
+ );
+
+ $request = new ezcWebdavPropPatchRequest( '/resource' );
+ $request->updates = $newProperties;
+ $request->validateHeaders();
+ $response = $backend->proppatch( $request );
+
+ $request = new ezcWebdavCopyRequest( '/resource', '/new_resource' );
+ $request->validateHeaders();
+ $response = $backend->copy( $request );
+
+ $this->assertEquals(
+ $response,
+ new ezcWebdavCopyResponse(
+ false
+ ),
+ 'Expected response does not match real response.',
+ 0,
+ 20
+ );
+
+ $this->assertTrue(
+ is_file( $this->tempDir . 'backend/.ezc/new_resource.xml' ),
+ 'Expected creation of property storage.'
+ );
+
+ $request = new ezcWebdavPropFindRequest( '/new_resource' );
+ $request->prop = $newProperties;
+ $request->validateHeaders();
+ $response = $backend->propfind( $request );
+
+ $responseProperty = new ezcWebdavBasicPropertyStorage();
+ $responseProperty->attach( $p1 );
+ $responseProperty->attach( $p2 );
+
+ $responseProperty->rewind();
+ $expectedResponse = new ezcWebdavMultistatusResponse(
+ new ezcWebdavPropFindResponse(
+ new ezcWebdavResource( '/new_resource' ),
+ new ezcWebdavPropStatResponse(
+ $responseProperty
+ )
+ )
+ );
+
+ $this->assertEquals(
+ $expectedResponse,
+ $response,
'Expected response does not match real response.',
0,
20
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components