public function testCopyCollectionWithInvalidETag() { $testSourcePath = '/collection'; $testSource = "{$testSourcePath}/deep_collection"; $testDestPath = $testSourcePath; $testDest = "{$testDestPath}/copied_collection"; $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/'); // Initialize all property directories $req = new ezcWebdavPropFindRequest($testSource); $req->allProp = true; $req->setHeader('Depth', ezcWebdavRequest::DEPTH_INFINITY); $req->validateHeaders(); $backend->propFind($req); $eTag = $backend->getProperty($testDestPath, 'getetag')->etag; $req = new ezcWebdavCopyRequest($testSource, $testDest); $req->setHeader('If-None-Match', array('abc23', $eTag)); $req->validateHeaders(); $res = $backend->copy($req); $this->assertEquals(new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_412, '/collection', 'If-None-Match header check failed.'), $res, 'Expected response does not match real response.', 0, 20); }
public function testResourceCopyDepthInfinityErrors() { $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/'); // Cause error by making file not readable chmod($this->tempDir . 'backend/collection/test.txt', 0); $request = new ezcWebdavCopyRequest('/collection', '/new_collection'); $request->setHeader('Depth', ezcWebdavRequest::DEPTH_INFINITY); $request->validateHeaders(); $response = $backend->copy($request); $this->assertEquals($response, new ezcWebdavMultistatusResponse(new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_423, '/collection/test.txt')), 'Expected response does not match real response.', 0, 20); $this->assertTrue(is_dir($this->tempDir . 'backend/new_collection'), 'Expected created collection.'); $this->assertFalse(is_file($this->tempDir . 'backend/new_collection/test.txt'), 'Expected file in collection not to be created.'); $this->assertTrue(is_file($this->tempDir . 'backend/new_collection/deep_collection/deep_test.txt'), 'Expected created deep file in collection.'); chmod($this->tempDir . 'backend/collection/test.txt', 0777); }