Passed
Push — feature/remove-setup-as-array ( 3bb37a...da7ebe )
by Jesús
04:16 queued 36s
created

ClassInfoTest.php$0 ➔ test_string_real_class()   A

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Unit\Framework\ClassResolver;
6
7
use Gacela\Framework\AbstractFacade;
8
use Gacela\Framework\ClassResolver\ClassInfo;
9
use GacelaTest\Fixtures\ClassInfoTestingFacade;
10
use PHPUnit\Framework\TestCase;
11
12
final class ClassInfoTest extends TestCase
13
{
14
    public function test_anonymous_class(): void
15
    {
16
        $facade = new class() extends AbstractFacade {
17
        };
18
        $actual = ClassInfo::from($facade, 'Factory');
19
20
        self::assertSame('module-name@anonymous\ClassInfoTest', $actual->getModule());
21
        self::assertSame('module-name@anonymous\ClassInfoTest', $actual->getFullNamespace());
22
        self::assertSame('\module-name@anonymous\ClassInfoTest\Factory', $actual->getCacheKey());
23
    }
24
25
    public function test_object_real_class(): void
26
    {
27
        $facade = new ClassInfoTestingFacade();
28
        $actual = ClassInfo::from($facade, 'Factory');
29
30
        self::assertSame('Fixtures', $actual->getModule());
31
        self::assertSame('GacelaTest\Fixtures', $actual->getFullNamespace());
32
        self::assertSame('\GacelaTest\Fixtures\Factory', $actual->getCacheKey());
33
    }
34
35
    public function test_string_real_class(): void
36
    {
37
        $actual = ClassInfo::from(ClassInfoTestingFacade::class, 'Factory');
38
39
        self::assertSame('Fixtures', $actual->getModule());
40
        self::assertSame('GacelaTest\Fixtures', $actual->getFullNamespace());
41
        self::assertSame('\GacelaTest\Fixtures\Factory', $actual->getCacheKey());
42
    }
43
}
44