aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-02-07 09:37:36 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2023-02-07 09:37:36 +0000
commita9ad7c6771196425c88f72cd546abc0e54d00ed9 (patch)
tree388b1e1910cc5706680641dee2b5b413fccf4c2b
parent5f5a44fd7ebf76a620378b93dff435c38d748c15 (diff)
fail safe unit test, fixes #2093
Closes #2093 Merge request studip/studip!1377
-rw-r--r--tests/unit/lib/classes/StudipFileloaderTest.php37
1 files changed, 20 insertions, 17 deletions
diff --git a/tests/unit/lib/classes/StudipFileloaderTest.php b/tests/unit/lib/classes/StudipFileloaderTest.php
index ec45793..1ffe6b5 100644
--- a/tests/unit/lib/classes/StudipFileloaderTest.php
+++ b/tests/unit/lib/classes/StudipFileloaderTest.php
@@ -8,34 +8,37 @@
* @copyright (c) Authors
*/
-class StudipFileloaderTestCase extends \Codeception\Test\Unit {
-
- public function setUp(): void {
- ArrayFileStream::set_filesystem(
- [
- 'pathto' => [
- 'config-1.php' => '<? $CONF = 17; '
- , 'config-2.php' => '<? $CONF = 17 + $offset; '
- ]]);
-
- if (!stream_wrapper_register("var", "ArrayFileStream")) {
- new Exception("Failed to register protocol");
+class StudipFileloaderTestCase extends \Codeception\Test\Unit
+{
+ public function setUp(): void
+ {
+ ArrayFileStream::set_filesystem([
+ 'pathto' => [
+ 'config-1.php' => '<?php $CONF = 17; ',
+ 'config-2.php' => '<?php $CONF = 17 + $offset; ',
+ ]
+ ]);
+
+ if (!stream_wrapper_register('var', 'ArrayFileStream')) {
+ new Exception('Failed to register protocol');
}
}
- public function tearDown(): void {
- stream_wrapper_unregister("var");
+ public function tearDown(): void
+ {
+ stream_wrapper_unregister('var');
}
- public function test_should_inject_vars() {
+ public function test_should_inject_vars()
+ {
$container = [];
StudipFileloader::load('var://pathto/config-1.php', $container);
$this->assertEquals(['CONF' => 17], $container);
}
- public function test_should_inject_vars_twice() {
-
+ public function test_should_inject_vars_twice()
+ {
foreach (range(1,2) as $i) {
$container = [];
StudipFileloader::load('var://pathto/config-1.php', $container);