Test Failed
Push — rename-prePlugins-to-plugins ( 6cb67c...6ec719 )
by Chema
04:14
created

test_singleton_altered_via_pre_plugin()   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 Method

Rating   Name   Duplication   Size   Complexity  
A FeatureTest::test_singleton_altered_via_plugin_with_constructor() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Framework\Plugins;
6
7
use Gacela\Framework\Bootstrap\GacelaConfig;
8
use Gacela\Framework\Container\Locator;
9
use Gacela\Framework\Gacela;
10
use GacelaTest\Feature\Framework\Plugins\Module\Infrastructure\ExamplePluginWithConstructor;
11
use GacelaTest\Feature\Framework\Plugins\Module\Infrastructure\ExamplePluginWithoutConstructor;
12
use GacelaTest\Fixtures\StringValue;
13
use PHPUnit\Framework\TestCase;
14
15
final class FeatureTest extends TestCase
16
{
17
    public function test_singleton_altered_via_plugin_with_constructor(): void
18
    {
19
        Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
20
            $config->addPlugin(ExamplePluginWithConstructor::class);
21
        });
22
23
        $singleton = Gacela::get(StringValue::class);
24
25
        self::assertSame('Set from plugin ExamplePluginWithConstructor', $singleton->value());
26
    }
27
28
    public function test_singleton_altered_via_plugin_without_constructor(): void
29
    {
30
        Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
31
            $config->addPlugin(ExamplePluginWithoutConstructor::class);
32
        });
33
34
        $singleton = Gacela::get(StringValue::class);
35
36
        self::assertSame('Set from plugin ExamplePluginWithoutConstructor', $singleton->value());
37
    }
38
}
39