DependedPluginsBootLoaderTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 15
dl 0
loc 34
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testBoot() 0 20 2
A setUp() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 *  This file is part of the Micro framework package.
7
 *
8
 *  (c) Stanislau Komar <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace Micro\Framework\Kernel\Test\Unit\Boot;
15
16
use Micro\Component\DependencyInjection\Container;
17
use Micro\Framework\Kernel\Boot\DependedPluginsBootLoader;
0 ignored issues
show
Bug introduced by
The type Micro\Framework\Kernel\B...pendedPluginsBootLoader 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 Micro\Framework\Kernel\Kernel;
19
use Micro\Framework\Kernel\KernelInterface;
20
use Micro\Framework\Kernel\Plugin\PluginDependedInterface;
21
use Micro\Framework\Kernel\Test\Unit\PluginHasDepends;
22
use PHPUnit\Framework\TestCase;
23
24
class DependedPluginsBootLoaderTest extends TestCase
25
{
26
    private KernelInterface|null $kernel = null;
27
28
    private object $pluginNotHasDepends;
0 ignored issues
show
introduced by
The private property $pluginNotHasDepends is not used, and could be removed.
Loading history...
29
30
    private PluginDependedInterface $pluginDependedWithEmptyDepends;
0 ignored issues
show
introduced by
The private property $pluginDependedWithEmptyDepends is not used, and could be removed.
Loading history...
31
32
    private PluginDependedInterface $pluginDependedWithDepends;
0 ignored issues
show
introduced by
The private property $pluginDependedWithDepends is not used, and could be removed.
Loading history...
33
34
    protected function setUp(): void
35
    {
36
    }
37
38
    public function testBoot()
39
    {
40
        $this->kernel = new Kernel(
41
            [
42
                PluginHasDepends::class,
43
            ],
44
            [],
45
            new Container(),
46
        );
47
48
        $bootLoader = new DependedPluginsBootLoader($this->kernel);
49
        $this->kernel->addBootLoader($bootLoader);
0 ignored issues
show
Bug introduced by
The method addBootLoader() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        $this->kernel->/** @scrutinizer ignore-call */ 
50
                       addBootLoader($bootLoader);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
        $this->kernel->run();
51
52
        $i = 0;
53
        foreach ($this->kernel->plugins() as $plugin) {
54
            ++$i;
55
        }
56
57
        $this->assertEquals(3, $i);
58
    }
59
}
60