diff --git a/tests/StreamFactoryTest.php b/tests/StreamFactoryTest.php index 924af93..6112eb4 100644 --- a/tests/StreamFactoryTest.php +++ b/tests/StreamFactoryTest.php @@ -61,6 +61,7 @@ public function testCreateStreamFromResource() public function testCreateStreamFromUnopenableFile() { $this->expectException(UnopenableStreamException::class); + $this->expectExceptionMessage(\sprintf('Unable to open file "%s/nonexistent.file" in mode "r"', __DIR__)); (new StreamFactory)->createStreamFromFile(__DIR__ . '/nonexistent.file', 'r'); } diff --git a/tests/StreamTest.php b/tests/StreamTest.php index f7c0939..341a774 100644 --- a/tests/StreamTest.php +++ b/tests/StreamTest.php @@ -15,12 +15,12 @@ class StreamTest extends TestCase { private $handle; - public function setUp() + protected function setUp() { $this->handle = \fopen('php://memory', 'r+b'); } - public function tearDown() + protected function tearDown() { if (\is_resource($this->handle)) { @@ -50,7 +50,7 @@ public function testDetach() $this->assertEquals($this->handle, $stream->detach()); $this->assertStreamResourceEquals($stream, null); - $this->assertEquals(null, $stream->detach()); + $this->assertNull($stream->detach()); } public function testClose() @@ -305,7 +305,7 @@ public function testGetMetadataUnresourceable() $stream = new Stream($this->handle); $stream->close(); - $this->assertEquals(null, $stream->getMetadata()); + $this->assertNull($stream->getMetadata()); } public function testGetSize() @@ -327,7 +327,7 @@ public function testGetSizeUnresourceable() $stream = new Stream($this->handle); $stream->close(); - $this->assertEquals(null, $stream->getSize()); + $this->assertNull($stream->getSize()); } public function testToString()