28 lines
851 B
PHP
28 lines
851 B
PHP
|
|
<?php
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace Phred\Providers\Core;
|
||
|
|
|
||
|
|
use DI\Container;
|
||
|
|
use DI\ContainerBuilder;
|
||
|
|
use Phred\Support\Contracts\ConfigInterface;
|
||
|
|
use Phred\Support\Contracts\ServiceProviderInterface;
|
||
|
|
|
||
|
|
final class TestingServiceProvider implements ServiceProviderInterface
|
||
|
|
{
|
||
|
|
public function register(ContainerBuilder $builder, ConfigInterface $config): void
|
||
|
|
{
|
||
|
|
$driver = (string) \Phred\Support\Config::get('app.drivers.test_runner', 'codeception');
|
||
|
|
$impl = match ($driver) {
|
||
|
|
'codeception' => \Phred\Testing\CodeceptionRunner::class,
|
||
|
|
default => \Phred\Testing\CodeceptionRunner::class,
|
||
|
|
};
|
||
|
|
|
||
|
|
$builder->addDefinitions([
|
||
|
|
\Phred\Testing\Contracts\TestRunnerInterface::class => \DI\autowire($impl),
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function boot(Container $container): void {}
|
||
|
|
}
|