Exemple #1
0
 public function testGetAccessPropertyStorageDirName()
 {
     mkdir($this->tempDir . 'backend/somefile.ezc');
     touch($this->tempDir . 'backend/somefile.ezc/testfile');
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     $backend->options->useMimeExts = false;
     $request = new ezcWebdavGetRequest('');
     $request->validateHeaders();
     $response = $backend->get($request);
     $this->assertTrue($response instanceof ezcWebdavGetCollectionResponse);
     $this->assertEquals(3, count($response->collection->childs));
 }
 public function testGetCollectionWithMultipleInvalidETags()
 {
     $testPath = '/collection';
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     $req = new ezcWebdavGetRequest($testPath);
     $req->setHeader('If-Match', array('sometag', 'some other tag', 'foobar'));
     $req->validateHeaders();
     $res = $backend->get($req);
     // Collection ETags are ignored on purpose!
     $this->assertEquals(new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_412, '/collection', 'If-Match header check failed.'), $res, 'Expected response does not match real response.', 0, 20);
 }
 public function testResourceDeepGet()
 {
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     $request = new ezcWebdavGetRequest('/collection/deep_collection/deep_test.txt');
     $request->validateHeaders();
     $response = $backend->get($request);
     $expectedResponse = new ezcWebdavGetResourceResponse(new ezcWebdavResource('/collection/deep_collection/deep_test.txt', $backend->getAllProperties('/collection/deep_collection/deep_test.txt'), "=========\nTest file\n=========\n\nAnd again some randome contents...\n"));
     $expectedResponse->setHeader('ETag', $backend->getProperty('/collection/deep_collection/deep_test.txt', 'getetag')->etag);
     $this->assertEquals($expectedResponse, $response, 'Expected response does not match real response.', 0, 20);
 }