Skip to content

Commit a425feb

Browse files
committed
Add AbstractTestContainer class
1 parent 35ae212 commit a425feb

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/AbstractTestContainer.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SimpleSAML\TestUtils;
6+
7+
/**
8+
* Class \SimpleSAML\TestUtils\AbstractTestContainer
9+
*/
10+
abstract class AbstractTestContainerSingleton
11+
{
12+
}

src/TestContainerSingleton.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SimpleSAML\TestUtils;
6+
7+
/**
8+
* Class \SimpleSAML\TestUtils\TestContainerSingleton
9+
*/
10+
final class TestContainerSingleton
11+
{
12+
protected static AbstractTestContainer $testContainer;
13+
14+
15+
/** Set a container to use. */
16+
public static function setContainer(AbstractTestContainer $testContainer): void
17+
{
18+
self::$testContainer = $testContainer;
19+
}
20+
21+
22+
public static function getContainer(): AbstractTestContainer
23+
{
24+
Assert::notNull(self::$testContainer, 'No container set.');
25+
return self::$testContainer;
26+
}
27+
}

0 commit comments

Comments
 (0)