コード例 #1
0
 public function testProppatchResourceWithInvalidETag()
 {
     $testPath = '/collection/test.txt';
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     $etag = $backend->getProperty($testPath, 'getetag')->etag;
     // Properties to patch
     $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);
     $req = new ezcWebdavProppatchRequest($testPath);
     $req->updates = $newProperties;
     $req->setHeader('If-None-Match', array('abc23', $etag, 'foobar'));
     $req->validateHeaders();
     $res = $backend->propPatch($req);
     $this->assertEquals(new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_412, $testPath, 'If-None-Match header check failed.'), $res, 'Expected response does not match real response.', 0, 20);
 }