Micro-PHP /
plugin-doctrine
| 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
|
|||
| 38 | $this->assertEquals($manager, $doctrine->getDefaultManager()); |
||
| 39 | |||
| 40 | $this->assertTrue($manager->getConnection()->connect()); |
||
| 41 | $manager->getConnection()->close(); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |
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.