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

MakerTestCase   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
dl 0
loc 28
rs 10
c 1
b 0
f 1
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A skipIfNotUsingFoundryBundle() 0 4 2
A tempFile() 0 3 1
A cleanupTmpDir() 0 3 1
A tempDir() 0 3 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