Passed
Push — add-pre-plugins ( a890af )
by Chema
03:45
created

FeatureTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 16
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_singleton_altered_via_pre_plugin() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Framework\PrePlugins;
6
7
use Gacela\Framework\Bootstrap\GacelaConfig;
8
use Gacela\Framework\Container\Locator;
9
use Gacela\Framework\Gacela;
10
use GacelaTest\Feature\Framework\PrePlugins\Module\Infrastructure\ExamplePlugin;
11
use GacelaTest\Fixtures\StringValue;
12
use PHPUnit\Framework\TestCase;
13
14
final class FeatureTest extends TestCase
15
{
16
    public function test_singleton_altered_via_pre_plugin(): void
17
    {
18
        Locator::getInstance()->add('singleton', new StringValue('original'));
19
20
        Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
21
            $config->prePlugins([
22
                ExamplePlugin::class,
23
            ]);
24
        });
25
26
        /** @var StringValue $singleton */
27
        $singleton = Locator::getInstance()->get('singleton');
28
29
        self::assertSame('updated from plugin', $singleton->value());
30
    }
31
}
32