diff options
author | redmatrix <git@macgirvin.com> | 2016-05-10 17:26:44 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-05-10 17:26:44 -0700 |
commit | 0b02a6d123b2014705998c94ddf3d460948d3eac (patch) | |
tree | 78ff2cab9944a4f5ab3f80ec93cbe1120de90bb2 /vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php | |
parent | 40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb (diff) | |
download | volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.gz volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.bz2 volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.zip |
initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import)
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php | 73 |
1 files changed, 45 insertions, 28 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php index 8947c6688..3708594e0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php @@ -22,73 +22,90 @@ class FileTest extends \PHPUnit_Framework_TestCase { function testPut() { - $file = new File(SABRE_TEMPDIR . '/file.txt'); - $result = $file->put('New contents'); - - $this->assertEquals('New contents',file_get_contents(SABRE_TEMPDIR . '/file.txt')); - $this->assertEquals('"' . md5('New contents') . '"', $result); + $filename = SABRE_TEMPDIR . '/file.txt'; + $file = new File($filename); + $result = $file->put('New contents'); + + $this->assertEquals('New contents',file_get_contents(SABRE_TEMPDIR . '/file.txt')); + $this->assertEquals( + '"' . + sha1( + fileinode($filename) . + filesize($filename ) . + filemtime($filename) + ) . '"', + $result + ); } function testRange() { - $file = new File(SABRE_TEMPDIR . '/file.txt'); - $file->put('0000000'); - $file->patch('111', 2, 3); + $file = new File(SABRE_TEMPDIR . '/file.txt'); + $file->put('0000000'); + $file->patch('111', 2, 3); - $this->assertEquals('0001110',file_get_contents(SABRE_TEMPDIR . '/file.txt')); + $this->assertEquals('0001110',file_get_contents(SABRE_TEMPDIR . '/file.txt')); } function testRangeStream() { - $stream = fopen('php://memory','r+'); - fwrite($stream, "222"); - rewind($stream); + $stream = fopen('php://memory','r+'); + fwrite($stream, "222"); + rewind($stream); - $file = new File(SABRE_TEMPDIR . '/file.txt'); - $file->put('0000000'); - $file->patch($stream, 2, 3); + $file = new File(SABRE_TEMPDIR . '/file.txt'); + $file->put('0000000'); + $file->patch($stream, 2, 3); - $this->assertEquals('0002220',file_get_contents(SABRE_TEMPDIR . '/file.txt')); + $this->assertEquals('0002220',file_get_contents(SABRE_TEMPDIR . '/file.txt')); } function testGet() { - $file = new File(SABRE_TEMPDIR . '/file.txt'); - $this->assertEquals('Contents',stream_get_contents($file->get())); + $file = new File(SABRE_TEMPDIR . '/file.txt'); + $this->assertEquals('Contents',stream_get_contents($file->get())); } function testDelete() { - $file = new File(SABRE_TEMPDIR . '/file.txt'); - $file->delete(); + $file = new File(SABRE_TEMPDIR . '/file.txt'); + $file->delete(); - $this->assertFalse(file_exists(SABRE_TEMPDIR . '/file.txt')); + $this->assertFalse(file_exists(SABRE_TEMPDIR . '/file.txt')); } function testGetETag() { - $file = new File(SABRE_TEMPDIR . '/file.txt'); - $this->assertEquals('"' . md5('Contents') . '"',$file->getETag()); - + $filename = SABRE_TEMPDIR . '/file.txt'; + $file = new File($filename); + $this->assertEquals( + '"' . + sha1( + fileinode($filename) . + filesize($filename ) . + filemtime($filename) + ) . '"', + $file->getETag() + ); } function testGetContentType() { - $file = new File(SABRE_TEMPDIR . '/file.txt'); - $this->assertNull($file->getContentType()); + $file = new File(SABRE_TEMPDIR . '/file.txt'); + $this->assertNull($file->getContentType()); } function testGetSize() { - $file = new File(SABRE_TEMPDIR . '/file.txt'); - $this->assertEquals(8,$file->getSize()); + $file = new File(SABRE_TEMPDIR . '/file.txt'); + $this->assertEquals(8,$file->getSize()); } |