"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/Sabre/DAV/FSExt/ServerTest.php" between
dav-4.0.2.tar.gz and dav-4.0.3.tar.gz

About: sabre/dav is a WebDAV framework for PHP allowing to create WebDAV, CalDAV and CardDAV servers.

ServerTest.php  (dav-4.0.2):ServerTest.php  (dav-4.0.3)
skipping to change at line 37 skipping to change at line 37
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Type' => ['application/octet-stream'], 'Content-Type' => ['application/octet-stream'],
'Content-Length' => [13], 'Content-Length' => [13],
'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($filenam e)))], 'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($filenam e)))],
'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemti me($filename)).'"'], 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemti me($filename)).'"'],
], ],
$this->response->getHeaders() $this->response->getHeaders()
); );
$this->assertEquals('Test contents', stream_get_contents($this->response ->body)); $this->assertEquals('Test contents', $this->response->getBodyAsString()) ;
} }
public function testHEAD() public function testHEAD()
{ {
$request = new HTTP\Request('HEAD', '/test.txt'); $request = new HTTP\Request('HEAD', '/test.txt');
$filename = $this->tempDir.'/test.txt'; $filename = $this->tempDir.'/test.txt';
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Type' => ['application/octet-stream'], 'Content-Type' => ['application/octet-stream'],
'Content-Length' => [13], 'Content-Length' => [13],
'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($this->t empDir.'/test.txt')))], 'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($this->t empDir.'/test.txt')))],
'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemti me($filename)).'"'], 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemti me($filename)).'"'],
], ],
$this->response->getHeaders() $this->response->getHeaders()
); );
$this->assertEquals(200, $this->response->status); $this->assertEquals(200, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
} }
public function testPut() public function testPut()
{ {
$request = new HTTP\Request('PUT', '/testput.txt'); $request = new HTTP\Request('PUT', '/testput.txt');
$filename = $this->tempDir.'/testput.txt'; $filename = $this->tempDir.'/testput.txt';
$request->setBody('Testing new file'); $request->setBody('Testing new file');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemti me($filename)).'"'], 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemti me($filename)).'"'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(201, $this->response->status); $this->assertEquals(201, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
$this->assertEquals('Testing new file', file_get_contents($filename)); $this->assertEquals('Testing new file', file_get_contents($filename));
} }
public function testPutAlreadyExists() public function testPutAlreadyExists()
{ {
$request = new HTTP\Request('PUT', '/test.txt', ['If-None-Match' => '*'] ); $request = new HTTP\Request('PUT', '/test.txt', ['If-None-Match' => '*'] );
$request->setBody('Testing new file'); $request->setBody('Testing new file');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
skipping to change at line 108 skipping to change at line 108
$request = new HTTP\Request('MKCOL', '/testcol'); $request = new HTTP\Request('MKCOL', '/testcol');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(201, $this->response->status); $this->assertEquals(201, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
$this->assertTrue(is_dir($this->tempDir.'/testcol')); $this->assertTrue(is_dir($this->tempDir.'/testcol'));
} }
public function testPutUpdate() public function testPutUpdate()
{ {
$request = new HTTP\Request('PUT', '/test.txt'); $request = new HTTP\Request('PUT', '/test.txt');
$request->setBody('Testing updated file'); $request->setBody('Testing updated file');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals('0', $this->response->getHeader('Content-Length')); $this->assertEquals('0', $this->response->getHeader('Content-Length'));
$this->assertEquals(204, $this->response->status); $this->assertEquals(204, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
$this->assertEquals('Testing updated file', file_get_contents($this->tem pDir.'/test.txt')); $this->assertEquals('Testing updated file', file_get_contents($this->tem pDir.'/test.txt'));
} }
public function testDelete() public function testDelete()
{ {
$request = new HTTP\Request('DELETE', '/test.txt'); $request = new HTTP\Request('DELETE', '/test.txt');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(204, $this->response->status); $this->assertEquals(204, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
$this->assertFalse(file_exists($this->tempDir.'/test.txt')); $this->assertFalse(file_exists($this->tempDir.'/test.txt'));
} }
public function testDeleteDirectory() public function testDeleteDirectory()
{ {
mkdir($this->tempDir.'/testcol'); mkdir($this->tempDir.'/testcol');
file_put_contents($this->tempDir.'/testcol/test.txt', 'Hi! I\'m a file w ith a short lifespan'); file_put_contents($this->tempDir.'/testcol/test.txt', 'Hi! I\'m a file w ith a short lifespan');
$request = new HTTP\Request('DELETE', '/testcol'); $request = new HTTP\Request('DELETE', '/testcol');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(204, $this->response->status); $this->assertEquals(204, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
$this->assertFalse(file_exists($this->tempDir.'/testcol')); $this->assertFalse(file_exists($this->tempDir.'/testcol'));
} }
public function testOptions() public function testOptions()
{ {
$request = new HTTP\Request('OPTIONS', '/'); $request = new HTTP\Request('OPTIONS', '/');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'DAV' => ['1, 3, extended-mkcol'], 'DAV' => ['1, 3, extended-mkcol'],
'MS-Author-Via' => ['DAV'], 'MS-Author-Via' => ['DAV'],
'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, C OPY, MOVE, REPORT'], 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, C OPY, MOVE, REPORT'],
'Accept-Ranges' => ['bytes'], 'Accept-Ranges' => ['bytes'],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(200, $this->response->status); $this->assertEquals(200, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
} }
public function testMove() public function testMove()
{ {
mkdir($this->tempDir.'/testcol'); mkdir($this->tempDir.'/testcol');
$request = new HTTP\Request('MOVE', '/test.txt', ['Destination' => '/tes tcol/test2.txt']); $request = new HTTP\Request('MOVE', '/test.txt', ['Destination' => '/tes tcol/test2.txt']);
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals(201, $this->response->status); $this->assertEquals(201, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
$this->assertEquals([ $this->assertEquals([
'Content-Length' => ['0'], 'Content-Length' => ['0'],
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertTrue( $this->assertTrue(
is_file($this->tempDir.'/testcol/test2.txt') is_file($this->tempDir.'/testcol/test2.txt')
); );
} }
skipping to change at line 223 skipping to change at line 223
new DAV\FS\Directory($this->tempDir.'/tree1'), new DAV\FS\Directory($this->tempDir.'/tree1'),
new DAV\FSExt\Directory($this->tempDir.'/tree2'), new DAV\FSExt\Directory($this->tempDir.'/tree2'),
])); ]));
$this->server->tree = $tree; $this->server->tree = $tree;
$request = new HTTP\Request('MOVE', '/tree1', ['Destination' => '/tree2/ tree1']); $request = new HTTP\Request('MOVE', '/tree1', ['Destination' => '/tree2/ tree1']);
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals(201, $this->response->status); $this->assertEquals(201, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
$this->assertEquals([ $this->assertEquals([
'Content-Length' => ['0'], 'Content-Length' => ['0'],
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertTrue( $this->assertTrue(
is_dir($this->tempDir.'/tree2/tree1') is_dir($this->tempDir.'/tree2/tree1')
); );
} }
public function testCopy() public function testCopy()
{ {
mkdir($this->tempDir.'/testcol'); mkdir($this->tempDir.'/testcol');
$request = new HTTP\Request('COPY', '/test.txt', ['Destination' => '/tes tcol/test2.txt']); $request = new HTTP\Request('COPY', '/test.txt', ['Destination' => '/tes tcol/test2.txt']);
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals(201, $this->response->status); $this->assertEquals(201, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
$this->assertEquals([ $this->assertEquals([
'Content-Length' => ['0'], 'Content-Length' => ['0'],
'X-Sabre-Version' => [DAV\Version::VERSION], 'X-Sabre-Version' => [DAV\Version::VERSION],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertTrue(is_file($this->tempDir.'/test.txt')); $this->assertTrue(is_file($this->tempDir.'/test.txt'));
$this->assertTrue(is_file($this->tempDir.'/testcol/test2.txt')); $this->assertTrue(is_file($this->tempDir.'/testcol/test2.txt'));
} }
} }
 End of changes. 11 change blocks. 
11 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)