Completed
Push — master ( 6366df...fbe022 )
by Kirill
23s queued 19s
created

NamedArgumentsInstantiatorTestCase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstantiator() 0 3 1
A testNamedConstructorInstantiatable() 0 10 1
1
<?php
2
3
/**
4
 * This file is part of Spiral Framework package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Attributes\Instantiator;
13
14
use Spiral\Attributes\Internal\Instantiator\InstantiatorInterface;
15
use Spiral\Attributes\Internal\Instantiator\NamedArgumentsInstantiator;
16
use Spiral\Tests\Attributes\Instantiator\Fixtures\NamedArgumentConstructorFixture;
17
18
/**
19
 * @group unit
20
 * @group instantiator
21
 */
22
class NamedArgumentsInstantiatorTestCase extends InstantiatorTestCase
23
{
24
    /**
25
     * @return InstantiatorInterface
26
     */
27
    protected function getInstantiator(): InstantiatorInterface
28
    {
29
        return new NamedArgumentsInstantiator();
30
    }
31
32
    public function testNamedConstructorInstantiatable(): void
33
    {
34
        $object = $this->new(NamedArgumentConstructorFixture::class, [
35
            'a' => 23,
36
            'b' => 42,
37
        ]);
38
39
        $this->assertSame(23, $object->a);
40
        $this->assertSame(42, $object->b);
41
        $this->assertSame(null, $object->c);
42
    }
43
}
44