Passed
Pull Request — master (#17)
by Aleksei
11:42
created

InjectorTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testInvokeUnionTypes() 0 9 1
A testMakeInternalClass() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Injector\Tests\Php8;
6
7
use DateTimeImmutable;
8
use DateTimeInterface;
9
use Yiisoft\Injector\Injector;
10
use Yiisoft\Injector\MissingInternalArgumentException;
11
use Yiisoft\Injector\Tests\Common\BaseInjectorTest;
12
use Yiisoft\Injector\Tests\Common\Support\EngineInterface;
13
use Yiisoft\Injector\Tests\Common\Support\EngineMarkTwo;
14
use Yiisoft\Injector\Tests\Common\Support\EngineVAZ2101;
15
use Yiisoft\Injector\Tests\Common\Support\MakeEngineMatherWithParam;
16
use Yiisoft\Injector\Tests\Php8\Support\TimerUnionTypes;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Injector\Tests\P...Support\TimerUnionTypes 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...
17
18
/**
19
 * @requires PHP 8
20
 */
21
class InjectorTest extends BaseInjectorTest
22
{
23
    public function testMakeInternalClass(): void
24
    {
25
        $container = $this->getContainer();
26
27
        $object = (new Injector($container))->make(\SplFileObject::class, [
28
            'file_name' => __FILE__,
29
            // second parameter skipped
30
            // third parameter skipped
31
            'context' => null,
32
            'other-parameter' => true,
33
        ]);
34
35
        $this->assertSame(basename(__FILE__), $object->getFilename());
36
    }
37
38
    public function testInvokeUnionTypes(): void
39
    {
40
        $time = new DateTimeImmutable();
41
        $container = $this->getContainer([DateTimeInterface::class => $time]);
42
43
        $object = (new Injector($container))
44
            ->make(TimerUnionTypes::class);
45
46
        $this->assertSame($object->getTime(), $time);
47
    }
48
}
49