Passed
Push — feature/allow-optional-project... ( 5c3cfb...144e57 )
by Chema
03:38
created

test_build_with_project_namespace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Unit\Framework\ClassResolver\ClassNameFinder\Rule;
6
7
use Gacela\Framework\ClassResolver\ClassInfo;
8
use Gacela\Framework\ClassResolver\ClassNameFinder\Rule\FinderRuleWithoutModulePrefix;
9
use PHPUnit\Framework\TestCase;
10
11
final class FinderRuleWithoutModulePrefixTest extends TestCase
12
{
13
    private FinderRuleWithoutModulePrefix $rule;
14
15
    protected function setUp(): void
16
    {
17
        $this->rule = new FinderRuleWithoutModulePrefix();
18
    }
19
20
    public function test_build_without_project_namespace(): void
21
    {
22
        $projectNamespace = '';
23
        $resolvableType = 'Factory';
24
        $classInfo = ClassInfo::from($this);
25
26
        $actual = $this->rule->buildClassCandidate($projectNamespace, $resolvableType, $classInfo);
27
28
        self::assertSame('\Rule\Factory', $actual);
29
    }
30
31
    public function test_build_with_project_namespace(): void
32
    {
33
        $projectNamespace = 'App';
34
        $resolvableType = 'Factory';
35
        $classInfo = ClassInfo::from($this);
36
37
        $actual = $this->rule->buildClassCandidate($projectNamespace, $resolvableType, $classInfo);
38
39
        self::assertSame('\App\Rule\Factory', $actual);
40
    }
41
}
42