示例#1
0
 public function testMakeCollectionWithSpaces()
 {
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     $this->assertFalse(is_dir($this->tempDir . 'backend/collection/new_collection'), 'Collection to create exists.');
     $request = new ezcWebdavMakeCollectionRequest('/collection/collection%20with%20spaces');
     $request->validateHeaders();
     $response = $backend->makeCollection($request);
     $this->assertEquals($response, new ezcWebdavMakeCollectionResponse('/collection/collection%20with%20spaces'), 'Expected response does not match real response.');
     $this->assertTrue(is_dir($this->tempDir . 'backend/collection/collection%20with%20spaces'), 'Expected created collection.');
     $this->assertTrue(is_dir($this->tempDir . 'backend/collection/collection%20with%20spaces/.ezc'), 'Expected property storage in directory.');
     $this->assertEquals('collection with spaces', $backend->getAllProperties('/collection/collection%20with%20spaces')->get('displayname', 'DAV:')->displayName);
 }
 public function testGetCollectionWithMultipleAndValidETag()
 {
     $testPath = '/collection';
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     $etag = $backend->getProperty($testPath, 'getetag')->etag;
     $req = new ezcWebdavGetRequest($testPath);
     $req->setHeader('If-Match', array('sometag', $etag, 'foobar'));
     $req->validateHeaders();
     $res = $backend->get($req);
     $expectedRes = new ezcWebdavGetCollectionResponse(new ezcWebdavCollection($testPath, $backend->getAllProperties($testPath), array(new ezcWebdavCollection('/collection/deep_collection'), new ezcWebdavResource('/collection/test.txt'))));
     $expectedRes->setHeader('ETag', $etag);
     $this->assertEquals($expectedRes, $res, 'Expected response does not match real response.', 0, 20);
 }
示例#3
0
 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);
 }