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:08:27 +02:00
parent b6531bf613
commit c6ff4c551e
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();
}
}