Passed
Push — allow-using-static-facade ( abf22d )
by Chema
04:22
created

FeatureTest::test_static_factory_from_facade()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
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\Module\Facade as TestStaticFacade;
9
use PHPUnit\Framework\TestCase;
10
11
final class FeatureTest extends TestCase
12
{
13
    public function setUp(): void
14
    {
15
        Gacela::bootstrap(__DIR__);
16
    }
17
18
    public function test_object_facade(): void
19
    {
20
        $greet = (new TestStaticFacade())->formalGreet('Jesus');
21
22
        self::assertSame('Hello, Jesus.', $greet);
23
    }
24
25
    public function test_non_existing_facade_method(): void
26
    {
27
        $this->expectExceptionMessage('Unknown method: unknownGreet');
28
29
        TestStaticFacade::unknownGreet('anything');
1 ignored issue
show
Bug introduced by
The method unknownGreet() does not exist on GacelaTest\Feature\Frame...ticFacade\Module\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

29
        TestStaticFacade::/** @scrutinizer ignore-call */ 
30
                          unknownGreet('anything');
Loading history...
30
    }
31
32
    public function test_static_facade(): void
33
    {
34
        $greet = TestStaticFacade::informalGreet('Chema');
35
36
        self::assertSame('Hi, Chema!', $greet);
37
    }
38
39
    public function test_static_factory_from_facade(): void
40
    {
41
        $value = TestStaticFacade::factory()
42
            ->getConfig()
43
            ->getConfigValue();
44
45
        self::assertSame('config-value', $value);
46
    }
47
}
48