Total Complexity | 6 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
18 | abstract class AbstractTest extends TestCase |
||
19 | { |
||
20 | /** |
||
21 | * @var ApplicationTester |
||
22 | */ |
||
23 | protected $tester; |
||
24 | |||
25 | /** |
||
26 | * @var Deployer |
||
27 | */ |
||
28 | protected $deployer; |
||
29 | |||
30 | public static function setUpBeforeClass(): void |
||
31 | { |
||
32 | self::cleanUp(); |
||
33 | mkdir(__TEMP_DIR__); |
||
34 | } |
||
35 | |||
36 | public static function tearDownAfterClass(): void |
||
37 | { |
||
38 | self::cleanUp(); |
||
39 | } |
||
40 | |||
41 | protected static function cleanUp() |
||
42 | { |
||
43 | if (is_dir(__TEMP_DIR__)) { |
||
44 | exec('rm -rf ' . __TEMP_DIR__); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | protected function init(string $recipe) |
||
49 | { |
||
50 | $console = new Application(); |
||
51 | $console->setAutoExit(false); |
||
52 | $this->tester = new ApplicationTester($console); |
||
53 | |||
54 | $this->deployer = new Deployer($console); |
||
55 | $this->deployer->importer->import($recipe); |
||
56 | $this->deployer->init(); |
||
57 | $this->deployer->config->set('deploy_path', __TEMP_DIR__ . '/{{hostname}}'); |
||
58 | } |
||
59 | |||
60 | protected function dep(string $recipe, string $task) |
||
71 | ]); |
||
72 | } |
||
73 | } |
||
74 |