phpci/PHPCI/Plugin/PhpSpec.php

48 lines
1 KiB
PHP
Raw Normal View History

2013-05-14 15:37:14 +02:00
<?php
2013-05-16 03:16:56 +02:00
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2013, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link http://www.phptesting.org/
*/
2013-05-14 15:37:14 +02:00
namespace PHPCI\Plugin;
/**
* PHP Spec Plugin - Allows PHP Spec testing.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
2013-05-14 15:37:14 +02:00
class PhpSpec implements \PHPCI\Plugin
{
protected $phpci;
2013-05-14 15:37:14 +02:00
public function __construct(\PHPCI\Builder $phpci, array $options = array())
{
$this->phpci = $phpci;
}
2013-05-14 15:37:14 +02:00
/**
* Runs PHP Spec tests.
*/
public function execute()
{
$curdir = getcwd();
chdir($this->phpci->buildPath);
2013-10-08 09:50:10 +02:00
$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;
}
}