drupal-civicrm/sites/all/modules/civicrm/Civi/Test/CiviEnvBuilder/SqlStep.php

31 lines
547 B
PHP
Raw Normal View History

2018-01-14 15:10:16 +02:00
<?php
namespace Civi\Test\CiviEnvBuilder;
class SqlStep implements StepInterface {
private $sql;
/**
* SqlFileStep constructor.
* @param string $sql
*/
public function __construct($sql) {
$this->sql = $sql;
}
public function getSig() {
return md5($this->sql);
}
public function isValid() {
return TRUE;
}
public function run($ctx) {
/** @var $ctx \CiviEnvBuilder */
if (\Civi\Test::execute($this->sql) === FALSE) {
throw new \RuntimeException("Cannot execute: {$this->sql}");
}
}
}