Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | public function test_should_create_only_writable_stream() |
||
14 | { |
||
15 | $this->expectException(RuntimeException::class); |
||
16 | $this->expectExceptionMessage('The stream is not readable'); |
||
17 | |||
18 | $stream = new FileStream($this->file, 'w'); |
||
19 | $stream->write('hello world'); |
||
20 | |||
21 | $this->assertSame('w', $stream->getMetadata('mode')); |
||
22 | $this->assertSame('', $stream->getContents()); |
||
23 | |||
24 | $this->assertFalse($stream->isReadable()); |
||
25 | $this->assertFalse($stream->isSeekable()); |
||
26 | $this->assertTrue($stream->isWritable()); |
||
27 | } |
||
47 |
If you suppress an error, we recommend checking for the error condition explicitly: