ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\FSExt\FileTest Class Reference
+ Inheritance diagram for Sabre\DAV\FSExt\FileTest:
+ Collaboration diagram for Sabre\DAV\FSExt\FileTest:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 testPut ()
 
 testRange ()
 
 testRangeStream ()
 
 testGet ()
 
 testDelete ()
 
 testGetETag ()
 
 testGetContentType ()
 
 testGetSize ()
 

Detailed Description

Definition at line 7 of file FileTest.php.

Member Function Documentation

◆ setUp()

Sabre\DAV\FSExt\FileTest::setUp ( )

Definition at line 9 of file FileTest.php.

9  {
10 
11  file_put_contents(SABRE_TEMPDIR . '/file.txt', 'Contents');
12 
13  }

◆ tearDown()

Sabre\DAV\FSExt\FileTest::tearDown ( )

Definition at line 15 of file FileTest.php.

References Sabre\TestUtil\clearTempDir().

15  {
16 
18 
19  }
static clearTempDir()
This function deletes all the contents of the temporary directory.
Definition: TestUtil.php:12
+ Here is the call graph for this function:

◆ testDelete()

Sabre\DAV\FSExt\FileTest::testDelete ( )

Definition at line 72 of file FileTest.php.

72  {
73 
74  $file = new File(SABRE_TEMPDIR . '/file.txt');
75  $file->delete();
76 
77  $this->assertFalse(file_exists(SABRE_TEMPDIR . '/file.txt'));
78 
79  }

◆ testGet()

Sabre\DAV\FSExt\FileTest::testGet ( )

Definition at line 65 of file FileTest.php.

65  {
66 
67  $file = new File(SABRE_TEMPDIR . '/file.txt');
68  $this->assertEquals('Contents', stream_get_contents($file->get()));
69 
70  }

◆ testGetContentType()

Sabre\DAV\FSExt\FileTest::testGetContentType ( )

Definition at line 96 of file FileTest.php.

96  {
97 
98  $file = new File(SABRE_TEMPDIR . '/file.txt');
99  $this->assertNull($file->getContentType());
100 
101  }

◆ testGetETag()

Sabre\DAV\FSExt\FileTest::testGetETag ( )

Definition at line 81 of file FileTest.php.

References $filename.

81  {
82 
83  $filename = SABRE_TEMPDIR . '/file.txt';
84  $file = new File($filename);
85  $this->assertEquals(
86  '"' .
87  sha1(
88  fileinode($filename) .
89  filesize($filename) .
90  filemtime($filename)
91  ) . '"',
92  $file->getETag()
93  );
94  }
$filename
Definition: buildRTE.php:89

◆ testGetSize()

Sabre\DAV\FSExt\FileTest::testGetSize ( )

Definition at line 103 of file FileTest.php.

103  {
104 
105  $file = new File(SABRE_TEMPDIR . '/file.txt');
106  $this->assertEquals(8, $file->getSize());
107 
108  }

◆ testPut()

Sabre\DAV\FSExt\FileTest::testPut ( )

Definition at line 21 of file FileTest.php.

References $filename, and $result.

21  {
22 
23  $filename = SABRE_TEMPDIR . '/file.txt';
24  $file = new File($filename);
25  $result = $file->put('New contents');
26 
27  $this->assertEquals('New contents', file_get_contents(SABRE_TEMPDIR . '/file.txt'));
28  $this->assertEquals(
29  '"' .
30  sha1(
31  fileinode($filename) .
32  filesize($filename) .
33  filemtime($filename)
34  ) . '"',
35  $result
36  );
37 
38  }
$result
$filename
Definition: buildRTE.php:89

◆ testRange()

Sabre\DAV\FSExt\FileTest::testRange ( )

Definition at line 40 of file FileTest.php.

40  {
41 
42  $file = new File(SABRE_TEMPDIR . '/file.txt');
43  $file->put('0000000');
44  $file->patch('111', 2, 3);
45 
46  $this->assertEquals('0001110', file_get_contents(SABRE_TEMPDIR . '/file.txt'));
47 
48  }

◆ testRangeStream()

Sabre\DAV\FSExt\FileTest::testRangeStream ( )

Definition at line 50 of file FileTest.php.

References GuzzleHttp\Psr7\$stream.

50  {
51 
52  $stream = fopen('php://memory', 'r+');
53  fwrite($stream, "222");
54  rewind($stream);
55 
56  $file = new File(SABRE_TEMPDIR . '/file.txt');
57  $file->put('0000000');
58  $file->patch($stream, 2, 3);
59 
60  $this->assertEquals('0002220', file_get_contents(SABRE_TEMPDIR . '/file.txt'));
61 
62  }
$stream
PHP stream implementation.

The documentation for this class was generated from the following file: