yiisoft /
validator
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Yiisoft\Validator\Tests; |
||
| 6 | |||
| 7 | use PHPUnit\Framework\TestCase; |
||
| 8 | use Yiisoft\Di\Container; |
||
| 9 | use Yiisoft\Di\ContainerConfig; |
||
| 10 | |||
| 11 | use function dirname; |
||
| 12 | |||
| 13 | abstract class BaseConfigTest extends TestCase |
||
| 14 | { |
||
| 15 | final protected function createContainer(array|null $params = null): Container |
||
| 16 | { |
||
| 17 | $config = ContainerConfig::create()->withDefinitions($this->getContainerDefinitions($params)); |
||
| 18 | |||
| 19 | return new Container($config); |
||
| 20 | } |
||
| 21 | |||
| 22 | final protected function getContainerDefinitions(array|null $params): array |
||
| 23 | { |
||
| 24 | if ($params === null) { |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 25 | $params = $this->getParams(); |
||
| 26 | } |
||
| 27 | |||
| 28 | return require dirname(__DIR__) . '/config/di.php'; |
||
| 29 | } |
||
| 30 | |||
| 31 | final protected function getParams(): array |
||
| 32 | { |
||
| 33 | return require dirname(__DIR__) . '/config/params.php'; |
||
| 34 | } |
||
| 35 | } |
||
| 36 |