|
| 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 56 of file FlySystemFileStreamAccessTest.php.
60 $this->filesystemMock = \Mockery::mock(FilesystemOperator::class);
61 $this->subject =
new FlySystemFileStreamAccess($this->filesystemMock);
◆ testPutStreamWhichShouldSucceed()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testPutStreamWhichShouldSucceed |
( |
| ) |
|
◆ testPutStreamWithDetachedStreamWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testPutStreamWithDetachedStreamWhichShouldFail |
( |
| ) |
|
Definition at line 252 of file FlySystemFileStreamAccessTest.php.
References $path, and ILIAS\Filesystem\Stream\Streams\ofString().
254 $path =
'/path/to/your/file';
255 $fileContent =
'Awesome file content';
259 $this->expectException(\InvalidArgumentException::class);
260 $this->expectExceptionMessage(
'The given stream must not be detached.');
262 $this->subject->putStream(
$path, $stream);
static ofString(string $string)
Creates a new stream with an initial value.
◆ testPutStreamWithGeneralFailureWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testPutStreamWithGeneralFailureWhichShouldFail |
( |
| ) |
|
Definition at line 231 of file FlySystemFileStreamAccessTest.php.
References $path, and ILIAS\Filesystem\Stream\Streams\ofString().
233 $path =
'/path/to/your/file';
234 $fileContent =
'Awesome file content';
237 $this->filesystemMock->shouldReceive(
'putStream')
239 ->withArgs([
$path, \resourceValue()])
242 $this->expectException(IOException::class);
243 $this->expectExceptionMessage(
"Could not put stream content into \"$path\"");
245 $this->subject->putStream(
$path, $stream);
static ofString(string $string)
Creates a new stream with an initial value.
◆ testReadStreamWhichShouldSucceed()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testReadStreamWhichShouldSucceed |
( |
| ) |
|
Definition at line 68 of file FlySystemFileStreamAccessTest.php.
References $path.
70 $path =
'/path/to/your/file';
71 $fileContent =
'Awesome file content';
72 $stream = fopen(
'data://text/plain,' . $fileContent, $fileContent,
'r');
74 $this->filesystemMock->shouldReceive(
'readStream')
79 $wrappedStream = $this->subject->readStream(
$path);
81 $this->assertSame($fileContent, $wrappedStream->getContents());
◆ testReadStreamWithGeneralFailureWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testReadStreamWithGeneralFailureWhichShouldFail |
( |
| ) |
|
Definition at line 107 of file FlySystemFileStreamAccessTest.php.
References $path.
109 $path =
'/path/to/your/file';
111 $this->filesystemMock->shouldReceive(
'readStream')
116 $this->expectException(IOException::class);
117 $this->expectExceptionMessage(
"Could not open stream for file \"$path\"");
119 $this->subject->readStream(
$path);
◆ testReadStreamWithMissingFileWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testReadStreamWithMissingFileWhichShouldFail |
( |
| ) |
|
Definition at line 88 of file FlySystemFileStreamAccessTest.php.
References $path.
90 $path =
'/path/to/your/file';
92 $this->filesystemMock->shouldReceive(
'readStream')
95 ->andThrow(UnableToReadFile::class);
98 $this->expectExceptionMessage(
"File \"$path\" not found.");
100 $this->subject->readStream(
$path);
Interface Observer Contains several chained tasks and infos about them.
◆ testUpdateStreamWhichShouldSucceed()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testUpdateStreamWhichShouldSucceed |
( |
| ) |
|
◆ testUpdateStreamWithDetachedStreamWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testUpdateStreamWithDetachedStreamWhichShouldFail |
( |
| ) |
|
Definition at line 287 of file FlySystemFileStreamAccessTest.php.
References $path, and ILIAS\Filesystem\Stream\Streams\ofString().
289 $path =
'/path/to/your/file';
290 $fileContent =
'Awesome file content';
294 $this->expectException(\InvalidArgumentException::class);
295 $this->expectExceptionMessage(
'The given stream must not be detached.');
297 $this->subject->updateStream(
$path, $stream);
static ofString(string $string)
Creates a new stream with an initial value.
◆ testUpdateStreamWithGeneralFailureWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testUpdateStreamWithGeneralFailureWhichShouldFail |
( |
| ) |
|
Definition at line 304 of file FlySystemFileStreamAccessTest.php.
References $path, and ILIAS\Filesystem\Stream\Streams\ofString().
306 $path =
'/path/to/your/file';
307 $fileContent =
'Awesome file content';
310 $this->filesystemMock
311 ->shouldReceive(
'writeStream')
313 ->withArgs([
$path, \resourceValue()])
314 ->andThrow(UnableToWriteFile::class);
316 $this->expectException(IOException::class);
317 $this->expectExceptionMessage(
"Unable to update Stream in \"$path\".");
319 $this->subject->updateStream(
$path, $stream);
static ofString(string $string)
Creates a new stream with an initial value.
◆ testUpdateStreamWithMissingFileWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testUpdateStreamWithMissingFileWhichShouldFail |
( |
| ) |
|
Definition at line 326 of file FlySystemFileStreamAccessTest.php.
References $path, and ILIAS\Filesystem\Stream\Streams\ofString().
328 $path =
'/path/to/your/file';
329 $fileContent =
'Awesome file content';
332 $this->filesystemMock
333 ->shouldReceive(
'writeStream')
335 ->withArgs([
$path, \resourceValue()])
336 ->andThrow(UnableToWriteFile::class);
339 $this->expectExceptionMessage(
"Unable to update Stream in \"$path\".");
341 $this->subject->updateStream(
$path, $stream);
Interface Observer Contains several chained tasks and infos about them.
static ofString(string $string)
Creates a new stream with an initial value.
◆ testWriteStreamWhichShouldSucceed()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testWriteStreamWhichShouldSucceed |
( |
| ) |
|
◆ testWriteStreamWithDetachedStreamWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testWriteStreamWithDetachedStreamWhichShouldFail |
( |
| ) |
|
Definition at line 149 of file FlySystemFileStreamAccessTest.php.
References $path, and ILIAS\Filesystem\Stream\Streams\ofString().
151 $path =
'/path/to/your/file';
152 $fileContent =
'Awesome file content';
156 $this->expectException(\InvalidArgumentException::class);
157 $this->expectExceptionMessage(
'The given stream must not be detached.');
159 $this->subject->writeStream(
$path, $stream);
static ofString(string $string)
Creates a new stream with an initial value.
◆ testWriteStreamWithExistingFileWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testWriteStreamWithExistingFileWhichShouldFail |
( |
| ) |
|
Definition at line 166 of file FlySystemFileStreamAccessTest.php.
References $path, and ILIAS\Filesystem\Stream\Streams\ofString().
168 $path =
'/path/to/your/file';
169 $fileContent =
'Awesome file content';
172 $this->filesystemMock
173 ->shouldReceive(
'fileExists')
177 $this->expectException(FileAlreadyExistsException::class);
178 $this->expectExceptionMessage(
"File \"$path\" already exists.");
180 $this->subject->writeStream(
$path, $stream);
static ofString(string $string)
Creates a new stream with an initial value.
◆ testWriteStreamWithFailingAdapterWhichShouldFail()
Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::testWriteStreamWithFailingAdapterWhichShouldFail |
( |
| ) |
|
Definition at line 187 of file FlySystemFileStreamAccessTest.php.
References $path, and ILIAS\Filesystem\Stream\Streams\ofString().
189 $path =
'/path/to/your/file';
190 $fileContent =
'Awesome file content';
193 $this->filesystemMock
194 ->shouldReceive(
'fileExists')
198 ->shouldReceive(
'writeStream')
200 ->withArgs([
$path, \resourceValue()])
201 ->andThrow(UnableToWriteFile::class);
203 $this->expectException(IOException::class);
204 $this->expectExceptionMessage(
"Could not write stream to file \"$path\"");
206 $this->subject->writeStream(
$path, $stream);
static ofString(string $string)
Creates a new stream with an initial value.
◆ $filesystemMock
Mockery LegacyMockInterface Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest::$filesystemMock |
|
private |
◆ $subject
The documentation for this class was generated from the following file: