diff --git a/tests/Sabre/DAV/FSExt/FileTest.php b/tests/Sabre/DAV/FSExt/FileTest.php index 2b759e5d0d..a4c2e4e3ea 100644 --- a/tests/Sabre/DAV/FSExt/FileTest.php +++ b/tests/Sabre/DAV/FSExt/FileTest.php @@ -34,7 +34,16 @@ public function testPut() ); } - public function testRange() + public function testRangeAppend() + { + $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file->put('0000000'); + $file->patch('111', 1); + + $this->assertEquals('0000000111', file_get_contents(SABRE_TEMPDIR.'/file.txt')); + } + + public function testRangeOffset() { $file = new File(SABRE_TEMPDIR.'/file.txt'); $file->put('0000000'); @@ -43,6 +52,24 @@ public function testRange() $this->assertEquals('0001110', file_get_contents(SABRE_TEMPDIR.'/file.txt')); } + public function testRangeOffsetEnd() + { + $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file->put('0000000'); + $file->patch('11', 3, -4); + + $this->assertEquals('0001100', file_get_contents(SABRE_TEMPDIR.'/file.txt')); + } + + public function testRangeOffsetDefault() + { + $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file->put('0000000'); + $file->patch('11', 0); + + $this->assertEquals('000000011', file_get_contents(SABRE_TEMPDIR.'/file.txt')); + } + public function testRangeStream() { $stream = fopen('php://memory', 'r+');