Passed
Push — feature/change-cache-to-profil... ( 160b60 )
by Chema
04:07
created

FileProfilerFeatureTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 9
c 1
b 0
f 0
dl 0
loc 22
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 3 1
A test_custom_profiler_dir() 0 7 1
A setUp() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Framework\CustomProfilerDirectory;
6
7
use Gacela\Framework\Bootstrap\GacelaConfig;
8
use Gacela\Framework\ClassResolver\ClassNameProfiler;
9
use Gacela\Framework\ClassResolver\DocBlockService\CustomServicesProfiler;
10
use Gacela\Framework\Gacela;
11
use GacelaTest\Feature\Util\DirectoryUtil;
12
use PHPUnit\Framework\TestCase;
13
14
final class FileProfilerFeatureTest extends TestCase
15
{
16
    public function setUp(): void
17
    {
18
        Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
19
            $config->setProfilerEnabled(true);
20
            $config->setProfilerDirectory('custom/profiler-dir');
21
        });
22
    }
23
24
    public function tearDown(): void
25
    {
26
        DirectoryUtil::removeDir(__DIR__ . '/custom/profiler-dir');
27
    }
28
29
    public function test_custom_profiler_dir(): void
30
    {
31
        $facade = new Module\Facade();
32
        self::assertSame('name', $facade->getName());
33
34
        self::assertFileExists(__DIR__ . '/custom/profiler-dir/' . ClassNameProfiler::CACHE_FILENAME);
35
        self::assertFileExists(__DIR__ . '/custom/profiler-dir/' . CustomServicesProfiler::CACHE_FILENAME);
36
    }
37
}
38