Passed
Push — main ( cee6e7...fbef6d )
by Chema
02:55
created

FeatureTest::test_single_binding_class()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Framework\ExtendConfig;
6
7
use Gacela\Framework\Bootstrap\GacelaConfig;
8
use Gacela\Framework\Gacela;
9
use GacelaTest\Feature\Framework\ExtendConfig\Module\Infrastructure\BindingStringValue;
10
use GacelaTest\Fixtures\StringValue;
11
use PHPUnit\Framework\TestCase;
12
13
final class FeatureTest extends TestCase
14
{
15
    public function test_single_binding_class(): void
16
    {
17
        Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
18
            $config->resetInMemoryCache();
19
            $config->extendGacelaConfig(BindingStringValue::class);
20
        });
21
22
        /** @var StringValue $singleton */
23
        $singleton = Gacela::get(StringValue::class);
24
25
        self::assertSame('Set from BindingStringValue', $singleton->value());
26
    }
27
28
    public function test_multiple_binding_class(): void
29
    {
30
        Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
31
            $config->resetInMemoryCache();
32
            $config->extendGacelaConfigs([BindingStringValue::class]);
33
        });
34
35
        /** @var StringValue $singleton */
36
        $singleton = Gacela::get(StringValue::class);
37
38
        self::assertSame('Set from BindingStringValue', $singleton->value());
39
    }
40
}
41