Class FlySystemFileStreamAccessTest.
More...
|
| setUp () |
| Sets up the fixture, for example, open a network connection. More...
|
|
◆ setUp()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::setUp |
( |
| ) |
|
|
protected |
Sets up the fixture, for example, open a network connection.
This method is called before a test is executed.
Definition at line 47 of file FlySystemFileStreamAccessTest.php.
51 $this->filesystemMock = \Mockery::mock(FilesystemInterface::class);
52 $this->subject =
new FlySystemFileStreamAccess($this->filesystemMock);
◆ testPutStreamWhichShouldSucceed()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testPutStreamWhichShouldSucceed |
( |
| ) |
|
Definition at line 194 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
196 $path =
'/path/to/your/file';
197 $fileContent =
'Awesome file content';
200 $this->filesystemMock->shouldReceive(
'putStream')
202 ->withArgs([$path, \resourceValue()])
205 $this->subject->putStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ testPutStreamWithDetachedStreamWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testPutStreamWithDetachedStreamWhichShouldFail |
( |
| ) |
|
Definition at line 233 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
235 $path =
'/path/to/your/file';
236 $fileContent =
'Awesome file content';
240 $this->expectException(\InvalidArgumentException::class);
241 $this->expectExceptionMessage(
'The given stream must not be detached.');
243 $this->subject->putStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ testPutStreamWithGeneralFailureWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testPutStreamWithGeneralFailureWhichShouldFail |
( |
| ) |
|
Definition at line 212 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
214 $path =
'/path/to/your/file';
215 $fileContent =
'Awesome file content';
218 $this->filesystemMock->shouldReceive(
'putStream')
220 ->withArgs([$path, \resourceValue()])
223 $this->expectException(IOException::class);
224 $this->expectExceptionMessage(
"Could not put stream content into \"$path\"");
226 $this->subject->putStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ testReadStreamWhichShouldSucceed()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testReadStreamWhichShouldSucceed |
( |
| ) |
|
Definition at line 59 of file FlySystemFileStreamAccessTest.php.
61 $path =
'/path/to/your/file';
62 $fileContent =
'Awesome file content';
63 $stream = fopen(
'data://text/plain,' . $fileContent, $fileContent,
'r');
65 $this->filesystemMock->shouldReceive(
'readStream')
70 $wrappedStream = $this->subject->readStream($path);
72 $this->assertSame($fileContent, $wrappedStream->getContents());
◆ testReadStreamWithGeneralFailureWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testReadStreamWithGeneralFailureWhichShouldFail |
( |
| ) |
|
Definition at line 98 of file FlySystemFileStreamAccessTest.php.
100 $path =
'/path/to/your/file';
102 $this->filesystemMock->shouldReceive(
'readStream')
107 $this->expectException(IOException::class);
108 $this->expectExceptionMessage(
"Could not open stream for file \"$path\"");
110 $this->subject->readStream($path);
◆ testReadStreamWithMissingFileWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testReadStreamWithMissingFileWhichShouldFail |
( |
| ) |
|
Definition at line 79 of file FlySystemFileStreamAccessTest.php.
81 $path =
'/path/to/your/file';
83 $this->filesystemMock->shouldReceive(
'readStream')
86 ->andThrow(FileNotFoundException::class);
89 $this->expectExceptionMessage(
"File \"$path\" not found.");
91 $this->subject->readStream($path);
Class ChatMainBarProvider .
Class FlySystemFileAccessTest.
◆ testUpdateStreamWhichShouldSucceed()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testUpdateStreamWhichShouldSucceed |
( |
| ) |
|
Definition at line 250 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
252 $path =
'/path/to/your/file';
253 $fileContent =
'Awesome file content';
256 $this->filesystemMock->shouldReceive(
'updateStream')
258 ->withArgs([$path, \resourceValue()])
261 $this->subject->updateStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ testUpdateStreamWithDetachedStreamWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testUpdateStreamWithDetachedStreamWhichShouldFail |
( |
| ) |
|
Definition at line 268 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
270 $path =
'/path/to/your/file';
271 $fileContent =
'Awesome file content';
275 $this->expectException(\InvalidArgumentException::class);
276 $this->expectExceptionMessage(
'The given stream must not be detached.');
278 $this->subject->updateStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ testUpdateStreamWithGeneralFailureWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testUpdateStreamWithGeneralFailureWhichShouldFail |
( |
| ) |
|
Definition at line 285 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
287 $path =
'/path/to/your/file';
288 $fileContent =
'Awesome file content';
291 $this->filesystemMock->shouldReceive(
'updateStream')
293 ->withArgs([$path, \resourceValue()])
296 $this->expectException(IOException::class);
297 $this->expectExceptionMessage(
"Could not update file \"$path\"");
299 $this->subject->updateStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ testUpdateStreamWithMissingFileWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testUpdateStreamWithMissingFileWhichShouldFail |
( |
| ) |
|
Definition at line 306 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
308 $path =
'/path/to/your/file';
309 $fileContent =
'Awesome file content';
312 $this->filesystemMock->shouldReceive(
'updateStream')
314 ->withArgs([$path, \resourceValue()])
315 ->andThrow(FileNotFoundException::class);
318 $this->expectExceptionMessage(
"File \"$path\" not found.");
320 $this->subject->updateStream($path, $stream);
Class ChatMainBarProvider .
static ofString($string)
Creates a new stream with an initial value.
Class FlySystemFileAccessTest.
◆ testWriteStreamWhichShouldSucceed()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testWriteStreamWhichShouldSucceed |
( |
| ) |
|
Definition at line 117 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
119 $path =
'/path/to/your/file';
120 $fileContent =
'Awesome file content';
123 $this->filesystemMock->shouldReceive(
'writeStream')
125 ->withArgs([$path, \resourceValue()])
128 $this->subject->writeStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ testWriteStreamWithDetachedStreamWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testWriteStreamWithDetachedStreamWhichShouldFail |
( |
| ) |
|
Definition at line 135 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
137 $path =
'/path/to/your/file';
138 $fileContent =
'Awesome file content';
142 $this->expectException(\InvalidArgumentException::class);
143 $this->expectExceptionMessage(
'The given stream must not be detached.');
145 $this->subject->writeStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ testWriteStreamWithExistingFileWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testWriteStreamWithExistingFileWhichShouldFail |
( |
| ) |
|
Definition at line 152 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
154 $path =
'/path/to/your/file';
155 $fileContent =
'Awesome file content';
158 $this->filesystemMock->shouldReceive(
'writeStream')
160 ->withArgs([$path, \resourceValue()])
161 ->andThrow(FileExistsException::class);
163 $this->expectException(FileAlreadyExistsException::class);
164 $this->expectExceptionMessage(
"File \"$path\" already exists.");
166 $this->subject->writeStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ testWriteStreamWithFailingAdapterWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testWriteStreamWithFailingAdapterWhichShouldFail |
( |
| ) |
|
Definition at line 173 of file FlySystemFileStreamAccessTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
175 $path =
'/path/to/your/file';
176 $fileContent =
'Awesome file content';
179 $this->filesystemMock->shouldReceive(
'writeStream')
181 ->withArgs([$path, \resourceValue()])
184 $this->expectException(IOException::class);
185 $this->expectExceptionMessage(
"Could not write stream to file \"$path\"");
187 $this->subject->writeStream($path, $stream);
static ofString($string)
Creates a new stream with an initial value.
◆ $filesystemMock
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::$filesystemMock |
|
private |
◆ $subject
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::$subject |
|
private |
The documentation for this class was generated from the following file: