From 47672c014fc75ba09ffeeaa327bd3b1abd8066b3 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Tue, 8 Oct 2013 10:26:11 +0100 Subject: [PATCH] Adding basic Behat plugin, fixes #101 --- PHPCI/Plugin/Behat.php | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 PHPCI/Plugin/Behat.php diff --git a/PHPCI/Plugin/Behat.php b/PHPCI/Plugin/Behat.php new file mode 100644 index 00000000..c9c832ce --- /dev/null +++ b/PHPCI/Plugin/Behat.php @@ -0,0 +1,47 @@ + + * @package PHPCI + * @subpackage Plugins + */ +class Behat implements \PHPCI\Plugin +{ + protected $phpci; + + public function __construct(\PHPCI\Builder $phpci, array $options = array()) + { + $this->phpci = $phpci; + } + + /** + * Runs Behat tests. + */ + public function execute() + { + $curdir = getcwd(); + chdir($this->phpci->buildPath); + + $phpspec = $this->phpci->findBinary('phpspec'); + + if (!$phpspec) { + $this->phpci->logFailure('Could not find phpspec.'); + return false; + } + + $success = $this->phpci->executeCommand($phpspec); + chdir($curdir); + + return $success; + } +}