* @package PHPCI * @subpackage Plugins */ class PhpSpec implements \PHPCI\Plugin { protected $phpci; protected $bootstrap; public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; if (!empty($options['bootstrap'])) { $this->bootstrap = $this->buildPath . $options['bootstrap']; } } /** * Runs PHP Spec tests. */ public function execute() { $curdir = getcwd(); chdir($this->phpci->buildPath); $phpspec = $this->phpci->findBinary(array('phpspec', 'phpspec.php')); if (!$phpspec) { $this->phpci->logFailure('Could not find phpspec.'); return false; } if ($this->bootstrap) { $success = $this->phpci->executeCommand($phpspec . ' -f d'); } else { $success = $this->phpci->executeCommand($phpspec . ' -f d --bootstrap "%s"', $this->bootstrap); } chdir($curdir); return $success; } }