* @package PHPCI * @subpackage Plugins */ class Behat implements \PHPCI\Plugin { protected $phpci; protected $features; public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; $this->features = ''; if (isset($options['executable'])) { $this->executable = $options['executable']; } else { $this->executable = $this->phpci->findBinary('atoum'); } if (!empty($options['features'])) { $this->features = $options['features']; } } /** * Runs Behat tests. */ public function execute() { $curdir = getcwd(); chdir($this->phpci->buildPath); $behat = $this->executable; if (!$behat) { $this->phpci->logFailure('Could not find behat.'); return false; } $success = $this->phpci->executeCommand($behat . ' --no-time --format="failed" %s', $this->features); chdir($curdir); return $success; } }