* @package PHPCI * @subpackage Plugins */ class Behat implements \PHPCI\Plugin { protected $phpci; protected $build; protected $features; /** * Standard Constructor * * $options['directory'] Output Directory. Default: %BUILDPATH% * $options['filename'] Phar Filename. Default: build.phar * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ * $options['stub'] Stub Content. No Default Value * * @param Builder $phpci * @param Build $build * @param array $options */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; $this->build = $build; $this->features = ''; if (isset($options['executable'])) { $this->executable = $options['executable']; } else { $this->executable = $this->phpci->findBinary('behat'); } 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 . ' %s', $this->features); chdir($curdir); return $success; } }