CliHelper.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace Codeception\Module;
// here you can define custom functions for CliGuy
class CliHelper extends \Codeception\Module
{
public function _beforeSuite($settings = [])
{
$this->debug('Building actor classes for claypit');
$this->getModule('Cli')->runShellCommand('php ' . codecept_root_dir() . 'codecept build -c ' . codecept_data_dir() . 'claypit');
}
public function _before(\Codeception\TestInterface $test)
{
codecept_debug('creating dirs');
$this->getModule('Filesystem')->copyDir(codecept_data_dir() . 'claypit', codecept_data_dir() . 'sandbox');
}
public function _after(\Codeception\TestInterface $test)
{
codecept_debug('deleting dirs');
$this->getModule('Filesystem')->deleteDir(codecept_data_dir() . 'sandbox');
chdir(\Codeception\Configuration::projectDir());
}
public function executeCommand($command, $fail = true)
{
$this->getModule('Cli')->runShellCommand('php ' . \Codeception\Configuration::projectDir() . 'codecept ' . $command . ' -n', $fail);
}
public function executeFailCommand($command)
{
$this->getModule('Cli')->runShellCommand('php '.\Codeception\Configuration::projectDir().'codecept '.$command.' -n', false);
}
public function seeDirFound($dir)
{
$this->assertTrue(is_dir($dir) && file_exists($dir), "Directory does not exist");
}
}