DoctrinePluginTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 12
c 2
b 1
f 0
dl 0
loc 21
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSqlitePlugin() 0 19 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\Plugin\Doctrine\Test\Unit;
15
16
use Micro\Kernel\App\AppKernel;
17
use Micro\Plugin\Doctrine\DoctrineFacadeInterface;
18
use Micro\Plugin\Doctrine\DoctrinePlugin;
19
use PHPUnit\Framework\TestCase;
20
21
class DoctrinePluginTest extends TestCase
22
{
23
    public function testSqlitePlugin()
24
    {
25
        $kernel = new AppKernel(
26
            [
27
                'ORM_DEFAULT_DRIVER' => 'pdo_sqlite',
28
                'ORM_DEFAULT_IN_MEMORY' => true,
29
            ],
30
            [DoctrinePlugin::class],
31
            'dev'
32
        );
33
34
        $kernel->run();
35
        /** @var DoctrineFacadeInterface $doctrine */
36
        $doctrine = $kernel->container()->get(DoctrineFacadeInterface::class);
37
        $manager = $doctrine->getManager();
0 ignored issues
show
Bug introduced by
The call to Doctrine\ORM\Tools\Conso...rProvider::getManager() has too few arguments starting with name. ( Ignorable by Annotation )

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

37
        /** @scrutinizer ignore-call */ 
38
        $manager = $doctrine->getManager();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
38
        $this->assertEquals($manager, $doctrine->getDefaultManager());
39
40
        $this->assertTrue($manager->getConnection()->connect());
41
        $manager->getConnection()->close();
42
    }
43
}
44