Skip to content
Snippets Groups Projects
Commit a9ad7c67 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fail safe unit test, fixes #2093

Closes #2093

Merge request studip/studip!1377
parent 5f5a44fd
No related branches found
No related tags found
1 merge request!4Draft: Icon creation
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment