FeatureTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Framework\DocBlockServiceAware;
6
7
use Gacela\Framework\Bootstrap\GacelaConfig;
8
use Gacela\Framework\Gacela;
9
use GacelaTest\Feature\Framework\DocBlockServiceAware\Module\Infrastructure\Command\HelloCommand;
10
use PHPUnit\Framework\TestCase;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\BufferedOutput;
13
14
final class FeatureTest extends TestCase
15
{
16
    protected function setUp(): void
17
    {
18
        Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
19
            $config->resetInMemoryCache();
20
        });
21
    }
22
23
    public function test_custom_service(): void
24
    {
25
        $output = new BufferedOutput();
26
27
        (new HelloCommand())->run(
28
            $this->createStub(InputInterface::class),
29
            $output,
30
        );
31
32
        $expected = <<<TXT
33
fake-admin(id:1)
34
fake-admin(id:2)
35
TXT;
36
37
        if (strcasecmp(substr(PHP_OS, 0, 3), 'WIN') == 0) {
38
            $expected = str_replace("\n", PHP_EOL, $expected);
39
        }
40
41
        self::assertSame($expected, $output->fetch());
42
    }
43
}
44