Better cleanup of registered streams

This commit is contained in:
Robin Appelman 2014-07-31 01:06:38 +02:00
commit 99ecfc5287
4 changed files with 26 additions and 7 deletions

View file

@ -21,8 +21,8 @@ class IteratorDirectory extends \PHPUnit_Framework_TestCase {
* @expectedException \BadMethodCallException
*/
public function testNoContext() {
stream_wrapper_register('iterator', '\Icewind\Streams\IteratorDirectory');
$context = stream_context_create(array());
stream_wrapper_register('iterator', '\Icewind\Streams\IteratorDirectory');
try {
opendir('iterator://', $context);
stream_wrapper_unregister('iterator');
@ -36,12 +36,12 @@ class IteratorDirectory extends \PHPUnit_Framework_TestCase {
* @expectedException \BadMethodCallException
*/
public function testInvalidSource() {
stream_wrapper_register('iterator', '\Icewind\Streams\IteratorDirectory');
$context = stream_context_create(array(
'dir' => array(
'array' => 2
)
));
stream_wrapper_register('iterator', '\Icewind\Streams\IteratorDirectory');
try {
opendir('iterator://', $context);
stream_wrapper_unregister('iterator');