Commit 583d65ab authored by Jeremy Mikola's avatar Jeremy Mikola

Check resource type in assertStreamContents()

parent 98acd147
...@@ -27,13 +27,17 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase ...@@ -27,13 +27,17 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
} }
/** /**
* Rewinds a stream and asserts its contents. * Asserts that a variable is a stream containing the expected data.
*
* Note: this will seek to the beginning of the stream before reading.
* *
* @param string $expectedContents * @param string $expectedContents
* @param resource $stream * @param resource $stream
*/ */
protected function assertStreamContents($expectedContents, $stream) protected function assertStreamContents($expectedContents, $stream)
{ {
$this->assertInternalType('resource', $stream);
$this->assertSame('stream', get_resource_type($stream));
$this->assertEquals($expectedContents, stream_get_contents($stream, -1,.0)); $this->assertEquals($expectedContents, stream_get_contents($stream, -1,.0));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment