Exemplo n.º 1
0
 public function testDeadPropertyRetrieval()
 {
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     $backend->options->useMimeExts = false;
     $newProperties = new ezcWebdavFlaggedPropertyStorage();
     $newProperties->attach($prop = 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);
     $this->assertTrue(is_file($this->tempDir . 'backend/.ezc/resource.xml'), 'Expected creation of property storage.');
     $request = new ezcWebdavPropFindRequest('/resource');
     $request->prop = $newProperties;
     $request->validateHeaders();
     $response = $backend->propfind($request);
     $responseProperty = new ezcWebdavBasicPropertyStorage();
     $responseProperty->attach($prop);
     $responseProperty->rewind();
     $expectedResponse = new ezcWebdavMultistatusResponse(new ezcWebdavPropFindResponse(new ezcWebdavResource('/resource'), new ezcWebdavPropStatResponse($responseProperty)));
     $this->assertEquals($expectedResponse, $response, 'Expected response does not match real response.', 0, 20);
     $this->assertEquals(new ezcWebdavDeadProperty('foo:', 'bar', "<?xml version=\"1.0\"?>\n<bar xmlns=\"foo:\">some content</bar>\n"), $backend->getProperty('/resource', 'bar', 'foo:'));
 }
Exemplo n.º 2
0
 public function testMakeCollectionWithInvalidETag()
 {
     $testDest = "/collection/new_collection";
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     // Initialize all property directories
     $req = new ezcWebdavPropFindRequest('');
     $req->allProp = true;
     $req->setHeader('Depth', ezcWebdavRequest::DEPTH_INFINITY);
     $req->validateHeaders();
     $backend->propFind($req);
     $eTag = $backend->getProperty('/collection', 'getetag')->etag;
     $req = new ezcWebdavMakeCollectionRequest($testDest);
     $req->setHeader('If-None-Match', array($eTag));
     $req->validateHeaders();
     $res = $backend->makeCollection($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);
 }
Exemplo n.º 3
0
 public function testETagGeneration()
 {
     $backendDir = $this->tempDir . 'backend/';
     $backend = new ezcWebdavFileBackend($backendDir);
     $this->assertEquals(md5('/resource' . filesize($backendDir . 'resource') . date('c', filemtime($backendDir . 'resource'))), $backend->getProperty('/resource', 'getetag')->etag);
 }