public function testMoveCollectionWithInvalidETag()
 {
     $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 ezcWebdavMoveRequest($testSource, $testDest);
     $req->setHeader('If-None-Match', array('abc23', $eTag));
     $req->validateHeaders();
     $res = $backend->move($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);
 }
示例#2
0
 public function testResourceMoveDepthInfinityErrors()
 {
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     // Cause error by making file not readable
     chmod($this->tempDir . 'backend/collection/test.txt', 0);
     $this->assertTrue(is_dir($this->tempDir . 'backend/collection'), 'Expected existing collection before request.');
     $request = new ezcWebdavMoveRequest('/collection', '/new_collection');
     $request->setHeader('Depth', ezcWebdavRequest::DEPTH_INFINITY);
     $request->validateHeaders();
     $response = $backend->move($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/collection'), 'Expected collection not to be removed.');
     $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);
 }