Passed
Pull Request — master (#17)
by Kevin
02:51
created

MakerTestCase::skipIfNotUsingFoundryBundle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace Zenstruck\Foundry\Tests\Functional\Bundle\Maker;
4
5
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
6
use Symfony\Component\Filesystem\Filesystem;
7
8
/**
9
 * @author Kevin Bond <[email protected]>
10
 */
11
abstract class MakerTestCase extends KernelTestCase
12
{
13
    /**
14
     * @before
15
     */
16
    public function skipIfNotUsingFoundryBundle(): void
17
    {
18
        if (!\getenv('USE_FOUNDRY_BUNDLE')) {
19
            $this->markTestSkipped('ZenstruckFoundryBundle not enabled.');
20
        }
21
    }
22
23
    /**
24
     * @before
25
     */
26
    public static function cleanupTmpDir(): void
27
    {
28
        (new Filesystem())->remove(self::tempDir());
29
    }
30
31
    protected static function tempDir(): string
32
    {
33
        return __DIR__.'/../../../Fixtures/tmp';
34
    }
35
36
    protected static function tempFile(string $path): string
37
    {
38
        return \sprintf('%s/%s', self::tempDir(), $path);
39
    }
40
}
41