5require_once
'Sabre/TestUtil.php';
11 file_put_contents(SABRE_TEMPDIR .
'/file.txt',
'Contents');
25 $result = $file->put(
'New contents');
27 $this->assertEquals(
'New contents', file_get_contents(SABRE_TEMPDIR .
'/file.txt'));
42 $file =
new File(SABRE_TEMPDIR .
'/file.txt');
43 $file->put(
'0000000');
44 $file->patch(
'111', 2, 3);
46 $this->assertEquals(
'0001110', file_get_contents(SABRE_TEMPDIR .
'/file.txt'));
52 $stream = fopen(
'php://memory',
'r+');
56 $file =
new File(SABRE_TEMPDIR .
'/file.txt');
57 $file->put(
'0000000');
60 $this->assertEquals(
'0002220', file_get_contents(SABRE_TEMPDIR .
'/file.txt'));
67 $file =
new File(SABRE_TEMPDIR .
'/file.txt');
68 $this->assertEquals(
'Contents', stream_get_contents($file->get()));
74 $file =
new File(SABRE_TEMPDIR .
'/file.txt');
77 $this->assertFalse(file_exists(SABRE_TEMPDIR .
'/file.txt'));
98 $file =
new File(SABRE_TEMPDIR .
'/file.txt');
99 $this->assertNull($file->getContentType());
105 $file =
new File(SABRE_TEMPDIR .
'/file.txt');
106 $this->assertEquals(8, $file->getSize());
An exception for terminatinating execution or to throw for unit testing.
static clearTempDir()
This function deletes all the contents of the temporary directory.
$stream
PHP stream implementation.