Passed
Branch main (d4fa2b)
by Chema
03:09
created

FeatureTest::test_factory_static_facade_method()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Framework\StaticFacade;
6
7
use Gacela\Framework\Gacela;
8
use GacelaTest\Feature\Framework\StaticFacade\ModuleA\Facade as TestStaticFacade;
9
use GacelaTest\Feature\Framework\StaticFacade\ModuleA\Factory as StaticFactory;
10
use GacelaTest\Feature\Framework\StaticFacade\ModuleB\Facade as TestObjectFacade;
11
use GacelaTest\Feature\Framework\StaticFacade\ModuleB\Factory as ObjectFactory;
12
use PHPUnit\Framework\TestCase;
13
14
final class FeatureTest extends TestCase
15
{
16
    public function setUp(): void
17
    {
18
        Gacela::bootstrap(__DIR__);
19
    }
20
21
    public function test_unknown_static_facade_method(): void
22
    {
23
        $this->expectExceptionMessage("Method unknown: 'unknown'");
24
25
        TestStaticFacade::unknown();
0 ignored issues
show
Bug introduced by
The method unknown() does not exist on GacelaTest\Feature\Frame...icFacade\ModuleA\Facade. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        TestStaticFacade::/** @scrutinizer ignore-call */ 
26
                          unknown();
Loading history...
26
    }
27
28
    public function test_module_a_static_facade(): void
29
    {
30
        $actual = TestStaticFacade::createString();
31
32
        self::assertSame(StaticFactory::STR, $actual);
33
    }
34
35
    public function test_module_a_object_facade(): void
36
    {
37
        $actual = (new TestObjectFacade())->createString();
38
39
        self::assertSame(ObjectFactory::STR, $actual);
40
    }
41
42
    public function test_factory_static_facade_method(): void
43
    {
44
        $actual = TestStaticFacade::getFactory()->createString();
45
46
        self::assertSame(StaticFactory::STR, $actual);
47
    }
48
}
49