<?php $backendBefore = new ezcWebdavMemoryBackend(); $backendBefore->addContents(array('collection' => array('resource.html' => '', 'newcollection' => array()))); $backendBefore->setProperty('/collection', new ezcWebdavLockDiscoveryProperty(new ArrayObject(array(new ezcWebdavLockDiscoveryPropertyActiveLock(ezcWebdavLockRequest::TYPE_WRITE, ezcWebdavLockRequest::SCOPE_EXCLUSIVE, ezcWebdavRequest::DEPTH_ZERO, new ezcWebdavPotentialUriContent('http://example.com/some/user', true), 604800, new ezcWebdavPotentialUriContent('opaquelocktoken:5678', true), null, new ezcWebdavDateTime()))))); $backendBefore->setProperty('/collection/newcollection', new ezcWebdavLockDiscoveryProperty(new ArrayObject(array(new ezcWebdavLockDiscoveryPropertyActiveLock(ezcWebdavLockRequest::TYPE_WRITE, ezcWebdavLockRequest::SCOPE_EXCLUSIVE, ezcWebdavRequest::DEPTH_INFINITY, new ezcWebdavPotentialUriContent('http://example.com/some/user', true), 604800, new ezcWebdavPotentialUriContent('opaquelocktoken:1234', true), null, new ezcWebdavDateTime()))))); return $backendBefore;
<?php $backendBefore = new ezcWebdavMemoryBackend(); $backendBefore->addContents(array('collection' => array('resource.html' => ''))); $backendBefore->setProperty('/collection', new ezcWebdavLockDiscoveryProperty()); $backendBefore->setProperty('/collection/resource.html', new ezcWebdavLockDiscoveryProperty()); return $backendBefore;
public function testSettingPropertyOnUnknownRessource() { $backend = new ezcWebdavMemoryBackend(true); $backend->addContents(array('foo' => 'bar')); $this->assertFalse($backend->setProperty('/bar', new ezcWebdavDeadProperty('wcv:', 'ctime', '123456')), 'Setting on unknown ressource sould return false.'); }
<?php $backend = new ezcWebdavMemoryBackend(true); $backend->addContents(array('collection' => array('file.txt' => 'Some text content.', 'subdir' => array('file.html' => '<html><body><h1>Test</h1></body></html>', 'file.xml' => "<?xml?>\n<content/>")), 'secure_collection' => array('file.txt' => 'Some text content.', 'subdir' => array('file.html' => '<html><body><h1>Test</h1></body></html>', 'file.xml' => "<?xml?>\n<content/>")), 'file.xml' => "<?xml ?>\n<content/>", 'file.bin' => "§\"\$%&")); $backend->setProperty('/collection/file.txt', new ezcWebdavGetContentTypeProperty('text/plain', 'utf-8')); $backend->setProperty('/collection/subdir/file.html', new ezcWebdavGetContentTypeProperty('text/html', 'utf-8')); $backend->setProperty('/collection/subdir/file.xml', new ezcWebdavGetContentTypeProperty('text/xml', 'utf-8')); $backend->setProperty('/file.xml', new ezcWebdavGetContentTypeProperty('text/xml', 'utf-8')); $backend->setProperty('/file.bin', new ezcWebdavGetContentTypeProperty('application/octet-stream', 'utf-8')); $backend->setProperty('/secure_collection/file.txt', new ezcWebdavGetContentTypeProperty('text/plain', 'utf-8')); $backend->setProperty('/secure_collection/subdir/file.html', new ezcWebdavGetContentTypeProperty('text/html', 'utf-8')); $backend->setProperty('/secure_collection/subdir/file.xml', new ezcWebdavGetContentTypeProperty('text/xml', 'utf-8')); return $backend;