Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
CreatesApplications
n/a
0 / 0
n/a
0 / 0
7
n/a
0 / 0
 createTestSymfonyApplication
n/a
0 / 0
n/a
0 / 0
1
 createTestLaravelApplication
n/a
0 / 0
n/a
0 / 0
2
 onlyLaravelApplication
n/a
0 / 0
n/a
0 / 0
2
 onlySymfonyApplication
n/a
0 / 0
n/a
0 / 0
2
1<?php
2namespace Apie\IntegrationTests\Concerns;
3
4use Apie\IntegrationTests\Applications\Laravel\LaravelTestApplication;
5use Apie\IntegrationTests\Applications\Symfony\SymfonyTestApplication;
6use Apie\IntegrationTests\Config\ApplicationConfig;
7use Apie\IntegrationTests\Config\BoundedContextConfig;
8use Apie\IntegrationTests\Interfaces\TestApplicationInterface;
9
10/**
11 * @codeCoverageIgnore
12 */
13trait CreatesApplications
14{
15    public function createTestSymfonyApplication(ApplicationConfig $applicationConfig, BoundedContextConfig $boundedContextConfig): ?TestApplicationInterface
16    {
17        return new SymfonyTestApplication($applicationConfig, $boundedContextConfig);
18    }
19
20    public function createTestLaravelApplication(ApplicationConfig $applicationConfig, BoundedContextConfig $boundedContextConfig): ?TestApplicationInterface
21    {
22        // you can not disable templating in Laravel
23        if (!$applicationConfig->doesIncludeTemplating()) {
24            return null;
25        }
26        return new LaravelTestApplication($applicationConfig, $boundedContextConfig);
27    }
28
29    public function onlyLaravelApplication(TestApplicationInterface $application): ?LaravelTestApplication
30    {
31        return $application instanceof LaravelTestApplication ? $application : null;
32    }
33
34    public function onlySymfonyApplication(TestApplicationInterface $application): ?SymfonyTestApplication
35    {
36        return $application instanceof SymfonyTestApplication ? $application : null;
37    }
38}