Commit | Line | Data |
---|---|---|
728bbd5b TO |
1 | <?php |
2 | namespace Civi\Test\CiviEnvBuilder; | |
34f3bbd9 | 3 | |
728bbd5b TO |
4 | class SqlStep implements StepInterface { |
5 | private $sql; | |
6 | ||
7 | /** | |
8 | * SqlFileStep constructor. | |
9 | * @param string $sql | |
10 | */ | |
11 | public function __construct($sql) { | |
12 | $this->sql = $sql; | |
13 | } | |
14 | ||
728bbd5b TO |
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 | } |