Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 10 |
CRAP | |
0.00% |
0 / 48 |
Test | |
0.00% |
0 / 1 |
|
0.00% |
0 / 10 |
182 | |
0.00% |
0 / 48 |
setDispatcher($dispatcher) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
setBootstrap($bootstrap) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
setGuyClass($guy) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
setUp() | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 10 |
|||
_before() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
tearDown() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
_after() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
__construct($name = NULL, array $data = array() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
getFeature() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 6 |
|||
getModule($module) | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 7 |
<?php | |
namespace Codeception\TestCase; | |
use Codeception\Exception\TestRuntime; | |
class Test extends \Codeception\TestCase | |
{ | |
/** | |
* @var \Symfony\Component\EventDispatcher\EventDispatcher | |
*/ | |
protected $dispatcher = null; | |
protected $bootstrap = null; | |
/** | |
* @var \CodeGuy | |
*/ | |
protected $codeGuy = null; | |
protected $guyClass; | |
public function setDispatcher($dispatcher) { | |
$this->dispatcher = $dispatcher; | |
} | |
public function setBootstrap($bootstrap) { | |
$this->bootstrap = $bootstrap; | |
} | |
public function setGuyClass($guy) | |
{ | |
$this->guyClass = $guy; | |
} | |
protected function setUp() | |
{ | |
if ($this->bootstrap) require $this->bootstrap; | |
$this->scenario = new \Codeception\Scenario($this); | |
$guy = $this->guyClass; | |
if ($guy) $this->codeGuy = new $guy($this->scenario); | |
$this->scenario->run(); | |
$this->fire('test.before', new \Codeception\Event\Test($this)); | |
$this->_before(); | |
} | |
/** | |
* @Override | |
*/ | |
protected function _before() | |
{ | |
} | |
protected function tearDown() | |
{ | |
$this->_after(); | |
$this->fire('test.after', new \Codeception\Event\Test($this)); | |
} | |
/** | |
* @Override | |
*/ | |
protected function _after() | |
{ | |
} | |
public function __construct($name = NULL, array $data = array(), $dataName = '') { | |
parent::__construct($name, $data, $dataName); | |
$this->scenario = new \Codeception\Scenario($this); | |
} | |
public function getFeature() { | |
$text = $this->getName(); | |
$text = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\\1 \\2', $text); | |
$text = preg_replace('/([a-z\d])([A-Z])/', '\\1 \\2', $text); | |
return strtolower($text); | |
} | |
/** | |
* @param $module | |
* @return \Codeception\Module | |
* @throws \Codeception\Exception\TestRuntime | |
*/ | |
public function getModule($module) | |
{ | |
if (isset(\Codeception\SuiteManager::$modules[$module])) { | |
return \Codeception\SuiteManager::$modules[$module]; | |
} | |
throw new TestRuntime("Module $module is not enabled for this test suite"); | |
} | |
} |