Passed
Push — master ( e23bc1...ee0f92 )
by Kevin
03:07
created

MakerTestCase::tempFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
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