Passed
Push — master ( f487e7...a987b1 )
by Andrii
03:14
created

BillRepositoryTest::testDI()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace hiqdev\billing\hiapi\tests\unit\bill;
4
5
use hiqdev\php\billing\bill\Bill;
6
use hiqdev\billing\hiapi\bill\BillRepository;
7
use hiqdev\yii\DataMapper\components\EntityManagerInterface;
8
9
class BillRepositoryTest extends \PHPUnit\Framework\TestCase
10
{
11
    public function testDI()
12
    {
13
        $this->assertInstanceOf(BillRepository::class, $this->getRepo());
14
    }
15
16
    protected function getRepo(): BillRepository
17
    {
18
        return $this->getEntityManager()->getRepository(Bill::class);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getEntityM...lling\bill\Bill::class) returns the type hiqdev\yii\DataMapper\repositories\BaseRepository which includes types incompatible with the type-hinted return hiqdev\billing\hiapi\bill\BillRepository.
Loading history...
19
    }
20
21
    protected function getEntityManager(): EntityManagerInterface
22
    {
23
        return $this->getContainer()->get(EntityManagerInterface::class);
24
    }
25
26
    protected function getContainer()
27
    {
28
        return class_exists('Yii') ? \Yii::$container : \yii\helpers\Yii::getContainer();
0 ignored issues
show
Bug introduced by
The type yii\helpers\Yii 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...
29
    }
30
}
31