forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKernel.php
38 lines (30 loc) · 896 Bytes
/
Kernel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace App;
use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
/** @final */
class Kernel extends BaseKernel
{
use MicroKernelTrait;
protected function getContainerBaseClass(): string
{
if (class_exists(MockerContainer::class) && $this->isTestEnvironment()) {
return MockerContainer::class;
}
return parent::getContainerBaseClass();
}
private function isTestEnvironment(): bool
{
return str_starts_with($this->getEnvironment(), 'test');
}
}