MDL-78002 phpunit: Ensure that all uses of psr streams are closed

While the uses here were not causing too much problem with PHPUnit
execution in any OS, better have them explicitly closed to better
serve as reference for other, future uses anywhere in codebase.

Always that a stream is used, better we close it as soon as possible,
not relying on destructors, gc and friends.
This commit is contained in:
Eloy Lafuente (stronk7)
2023-04-29 23:05:06 +02:00
parent 2b61e95a69
commit e4eb21e0ea
2 changed files with 2 additions and 0 deletions
@@ -1093,6 +1093,7 @@ class file_system_test extends \advanced_testcase {
$this->assertInstanceOf(\Psr\Http\Message\StreamInterface::class, $stream);
$this->assertEquals(file_get_contents(__FILE__), $stream->getContents());
$this->assertFalse($stream->isWritable());
$stream->close();
}
/**
@@ -118,6 +118,7 @@ class stored_file_test extends advanced_testcase {
$this->assertInstanceOf(\Psr\Http\Message\StreamInterface::class, $stream);
$this->assertEquals(file_get_contents($filepath), $stream->getContents());
$this->assertFalse($stream->isWritable());
$stream->close();
}
}