Exemplo n.º 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);
 }
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 testMakeCollection()
 {
     $backend = new ezcWebdavFileBackend($this->tempDir . 'backend/');
     $this->assertFalse(is_dir($this->tempDir . 'backend/collection/new_collection'), 'Expected collection not existing yet.');
     $request = new ezcWebdavMakeCollectionRequest('/collection/new_collection');
     $request->validateHeaders();
     $response = $backend->makeCollection($request);
     $this->assertEquals($response, new ezcWebdavMakeCollectionResponse('/bar/foo'), 'Expected response does not match real response.', 0, 20);
     $this->assertTrue(is_dir($this->tempDir . 'backend/collection/new_collection'), 'Expected created collection.');
     $this->assertTrue(is_dir($this->tempDir . 'backend/collection/new_collection/.ezc'), 'Expected property storage in directory.');
 }