Passed
Push — feature/custom-caching-dir ( f598fb )
by Chema
04:58
created

FeatureTest::test_custom_caching_dir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Framework\CustomCacheDirectory;
6
7
use Gacela\Framework\Bootstrap\GacelaConfig;
8
use Gacela\Framework\ClassResolver\ClassNameCache;
9
use Gacela\Framework\ClassResolver\DocBlockService\CustomServicesCache;
10
use Gacela\Framework\Gacela;
11
use GacelaTest\Feature\Util\DirectoryUtil;
12
use PHPUnit\Framework\TestCase;
13
14
final class FeatureTest extends TestCase
15
{
16
    public function setUp(): void
17
    {
18
        Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
19
            $config->addAppConfig('config/*.php');
20
            $config->setCacheDirectory('custom-caching-dir');
21
        });
22
    }
23
24
    public function tearDown(): void
25
    {
26
        DirectoryUtil::removeDir(__DIR__ . '/custom-caching-dir');
27
    }
28
29
    public function test_custom_caching_dir(): void
30
    {
31
        $facade = new Module\Facade();
32
        self::assertSame('name', $facade->getName());
33
34
        self::assertFileExists(__DIR__ . '/custom-caching-dir/' . ClassNameCache::CACHE_FILENAME);
35
        self::assertFileExists(__DIR__ . '/custom-caching-dir/' . CustomServicesCache::CACHE_FILENAME);
36
    }
37
}
38