Commit | Line | Data |
---|---|---|
728bbd5b TO |
1 | <?php |
2 | namespace Civi\Test\CiviEnvBuilder; | |
3 | class SqlStep implements StepInterface { | |
4 | private $sql; | |
5 | ||
6 | /** | |
7 | * SqlFileStep constructor. | |
8 | * @param string $sql | |
9 | */ | |
10 | public function __construct($sql) { | |
11 | $this->sql = $sql; | |
12 | } | |
13 | ||
14 | ||
15 | public function getSig() { | |
16 | return md5($this->sql); | |
17 | } | |
18 | ||
19 | public function isValid() { | |
20 | return TRUE; | |
21 | } | |
22 | ||
23 | public function run($ctx) { | |
24 | /** @var $ctx \CiviEnvBuilder */ | |
25 | if (\Civi\Test::execute($this->sql) === FALSE) { | |
26 | throw new \RuntimeException("Cannot execute: {$this->sql}"); | |
27 | } | |
28 | } | |
29 | ||
30 | } |