aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-10-21 15:46:31 -0700
committerfriendica <info@friendica.com>2013-10-21 15:46:31 -0700
commitb35122f7a6ad42756c35bb60ba1f06c3dcd45c77 (patch)
treeccdf373ce6475d264778523259cc32899b732fe7 /vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php
parente3504df514d306cfe6b83e44a11f550664564af4 (diff)
downloadvolse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.tar.gz
volse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.tar.bz2
volse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.zip
add sabre (1.8.x) via composer in the !@#$ place it wants to be
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php95
1 files changed, 95 insertions, 0 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php
new file mode 100644
index 000000000..265f9f1c1
--- /dev/null
+++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php
@@ -0,0 +1,95 @@
+<?php
+
+namespace Sabre\DAV\FSExt;
+
+use Sabre\DAV;
+
+require_once 'Sabre/TestUtil.php';
+
+class FileTest extends \PHPUnit_Framework_TestCase {
+
+ function setUp() {
+
+ file_put_contents(SABRE_TEMPDIR . '/file.txt', 'Contents');
+
+ }
+
+ function tearDown() {
+
+ \Sabre\TestUtil::clearTempDir();
+
+ }
+
+ 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);
+
+ }
+
+ function testRange() {
+
+ $file = new File(SABRE_TEMPDIR . '/file.txt');
+ $file->put('0000000');
+ $file->putRange('111',3);
+
+ $this->assertEquals('0011100',file_get_contents(SABRE_TEMPDIR . '/file.txt'));
+
+ }
+
+ function testRangeStream() {
+
+ $stream = fopen('php://memory','r+');
+ fwrite($stream, "222");
+ rewind($stream);
+
+ $file = new File(SABRE_TEMPDIR . '/file.txt');
+ $file->put('0000000');
+ $file->putRange($stream,3);
+
+ $this->assertEquals('0022200',file_get_contents(SABRE_TEMPDIR . '/file.txt'));
+
+ }
+
+
+ function testGet() {
+
+ $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();
+
+ $this->assertFalse(file_exists(SABRE_TEMPDIR . '/file.txt'));
+
+ }
+
+ function testGetETag() {
+
+ $file = new File(SABRE_TEMPDIR . '/file.txt');
+ $this->assertEquals('"' . md5('Contents') . '"',$file->getETag());
+
+ }
+
+ function testGetContentType() {
+
+ $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());
+
+ }
+
+}