Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
42 | protected static function createClient(array $options = []): Client |
||
43 | { |
||
44 | $kernel = static::bootKernel($options); |
||
45 | |||
46 | try { |
||
47 | /** |
||
48 | * @var Client |
||
49 | */ |
||
50 | $client = $kernel->getContainer()->get('test.api_platform.client'); |
||
51 | } catch (ServiceNotFoundException $e) { |
||
52 | if (class_exists(KernelBrowser::class)) { |
||
53 | throw new \LogicException('You cannot create the client used in functional tests if the "framework.test" config is not set to true.'); |
||
54 | } |
||
55 | throw new \LogicException('You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require symfony/browser-kit".'); |
||
56 | } |
||
57 | |||
58 | self::getHttpClient($client); |
||
59 | self::getClient($client->getKernelBrowser()); |
||
60 | |||
61 | return $client; |
||
62 | } |
||
64 |