Issues (1)

tests/Kernel/TestKernel.php (1 issue)

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 10 and the first side effect is on line 5.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace Flagbit\Bundle\TableAttributeBundle\Test\Kernel;
4
5
require_once __DIR__.'/../../vendor/akeneo/pim-community-dev/src/Kernel.php';
6
7
use Kernel;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
10
class TestKernel extends Kernel
11
{
12
    public function registerBundles(): iterable
13
    {
14
        $bundles = include __DIR__ . '/../../vendor/akeneo/pim-community-dev/config/bundles.php';
15
        $bundles += include __DIR__ . '/config/bundles.php';
16
17
        foreach ($bundles as $class => $envs) {
18
            if ($envs[$this->environment] ?? $envs['all'] ?? false) {
19
                yield new $class();
20
            }
21
        }
22
    }
23
24
    public function getRootDir(): string
25
    {
26
        return __DIR__;
27
    }
28
29
    public function getProjectDir(): string
30
    {
31
        return __DIR__;
32
    }
33
34
    protected function build(ContainerBuilder $container)
35
    {
36
        $serviceIds = [
37
            'pim_catalog.validator.constraint_guesser.chained_attribute',
38
            'akeneo.pim.enrichment.factory.value',
39
            'pim_catalog.repository.attribute',
40
            'pim_catalog.repository.cached_attribute',
41
            'form.extension',
42
        ];
43
        $container->addCompilerPass(new PublicServiceCompilerPass($serviceIds));
44
        $container->addCompilerPass(new EnterpriseFilterStubPass('product_proposal'));
45
        $container->addCompilerPass(new EnterpriseFilterStubPass('published_product'));
46
    }
47
}