Issues (63)

Tests/WithPrimeShellTest.php (5 issues)

1
<?php
2
3
namespace Bdf\PrimeBundle\Tests;
4
5
require_once __DIR__.'/TestKernel.php';
6
7
use Bdf\Prime\Shell\PrimeShellCommand;
0 ignored issues
show
The type Bdf\Prime\Shell\PrimeShellCommand 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...
8
use Bdf\PrimeBundle\PrimeBundle;
9
use PHPUnit\Framework\TestCase;
10
use Symfony\Bundle\FrameworkBundle\Console\Application;
11
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
12
use Symfony\Component\Config\Loader\LoaderInterface;
13
use Symfony\Component\Console\Command\LazyCommand;
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\HttpKernel\Kernel;
16
17
class WithPrimeShellTest extends TestCase
18
{
19
    private $kernel;
20
21
    protected function setUp(): void
22
    {
23
        if (!class_exists(PrimeShellCommand::class)) {
24
            $this->markTestSkipped('PrimeShell not installed');
25
        }
26
27
        $this->kernel = new class('test', true) extends Kernel {
28
            use \Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
0 ignored issues
show
The trait Symfony\Bundle\Framework...Kernel\MicroKernelTrait requires the property $instanceof which is not provided by anonymous//Tests/WithPrimeShellTest.php$0.
Loading history...
29
30
            public function registerBundles(): iterable
31
            {
32
                return [
33
                    new FrameworkBundle(),
34
                    new PrimeBundle(),
35
                ];
36
            }
37
38
            protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
0 ignored issues
show
The parameter $c is not used and could be removed. ( Ignorable by Annotation )

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

38
            protected function configureContainer(/** @scrutinizer ignore-unused */ ContainerBuilder $c, LoaderInterface $loader)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
            {
40
                $loader->import(__DIR__.'/Fixtures/config.yaml');
0 ignored issues
show
The method import() does not exist on Symfony\Component\Config\Loader\LoaderInterface. It seems like you code against a sub-type of Symfony\Component\Config\Loader\LoaderInterface such as Symfony\Component\Config\Loader\Loader. ( Ignorable by Annotation )

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

40
                $loader->/** @scrutinizer ignore-call */ 
41
                         import(__DIR__.'/Fixtures/config.yaml');
Loading history...
41
            }
42
43
            protected function configureRoutes($routes)
0 ignored issues
show
The parameter $routes is not used and could be removed. ( Ignorable by Annotation )

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

43
            protected function configureRoutes(/** @scrutinizer ignore-unused */ $routes)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
44
            {
45
            }
46
        };
47
        $this->kernel->boot();
48
    }
49
50
    public function testCommands()
51
    {
52
        $app = new Application($this->kernel);
53
54
        $command = $app->get('prime:shell');
55
56
        if ($command instanceof LazyCommand) {
57
            $command = $command->getCommand();
58
        }
59
60
        $this->assertInstanceOf(PrimeShellCommand::class, $command);
61
    }
62
}
63