Skip to content

Commit 7ed3417

Browse files
committed
Adding tests for read file modes on StreamProcessor
1 parent a086211 commit 7ed3417

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/VCR/Util/StreamProcessorTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,19 @@ public function streamOpenAppendFilterProvider()
5858
);
5959
}
6060

61-
public function testStreamOpenShouldNotFailOnInexistingFile()
61+
public function streamOpenFileModesWhichDoNotCreateFiles()
62+
{
63+
return array(
64+
array('r'),
65+
array('rb'),
66+
array('rt'),
67+
array('r+')
68+
);
69+
}
70+
/**
71+
* @dataProvider streamOpenFileModesWhichDoNotCreateFiles
72+
*/
73+
public function testStreamOpenShouldNotFailOnNonExistingFile($fileMode)
6274
{
6375
$test = $this;
6476
set_error_handler(function ($errno, $errstr, $errfile, $errline) use ($test) {
@@ -67,7 +79,7 @@ public function testStreamOpenShouldNotFailOnInexistingFile()
6779

6880
$processor = new StreamProcessor();
6981

70-
$result = $processor->stream_open('tests/fixtures/unknown', 'r', StreamProcessor::STREAM_OPEN_FOR_INCLUDE, $fullPath);
82+
$result = $processor->stream_open('tests/fixtures/unknown', $fileMode, StreamProcessor::STREAM_OPEN_FOR_INCLUDE, $fullPath);
7183
$this->assertFalse($result);
7284

7385
restore_error_handler();

0 commit comments

Comments
 (0)