Test Failed
Push — master ( d05989...c90c22 )
by Elijah
02:27
created

BundleTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A testBuildCompilerPasses() 0 22 4
1
<?php
2
3
/*
4
 * This file is part of the EloyekunlePermissionsBundle package.
5
 *
6
 * (c) Elijah Oyekunle <https://elijahoyekunle.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Eloyekunle\PermissionsBundle\Tests;
13
14
use Eloyekunle\PermissionsBundle\DependencyInjection\Compiler\DoctrineMappingPass;
15
use Eloyekunle\PermissionsBundle\DependencyInjection\Compiler\ValidationPass;
16
use Eloyekunle\PermissionsBundle\EloyekunlePermissionsBundle;
17
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
20
class BundleTest extends TestCase
21
{
22
    public function testBuildCompilerPasses()
23
    {
24
        $container = new ContainerBuilder();
25
        $bundle = new EloyekunlePermissionsBundle();
26
        $bundle->build($container);
27
28
        $config = $container->getCompilerPassConfig();
29
        $passes = $config->getBeforeOptimizationPasses();
30
31
        $foundMappingPass = false;
32
        $foundValidation = false;
33
34
        foreach ($passes as $pass) {
35
            if ($pass instanceof ValidationPass) {
36
                $foundValidation = true;
37
            } elseif ($pass instanceof DoctrineMappingPass) {
38
                $foundMappingPass = true;
39
            }
40
        }
41
42
        $this->assertTrue($foundMappingPass, 'DoctrineMappingPass was not found');
43
        $this->assertTrue($foundValidation, 'ValidationPass was not found');
44
    }
45
}
46