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

ClassInfoTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 30
rs 10
wmc 3

6 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ test_anonymous_class() 0 9 1
test_anonymous_class() 0 9 ?
test_object_real_class() 0 8 ?
A hp$0 ➔ test_string_real_class() 0 7 1
test_string_real_class() 0 7 ?
A hp$0 ➔ test_object_real_class() 0 8 1
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