Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00%
0 / 1
0.00%
0 / 7
CRAP
0.00%
0 / 47
Cept
0.00%
0 / 1
0.00%
0 / 7
182
0.00%
0 / 47
 __construct(EventDispatcher $dispatcher, array $data = array()
0.00%
0 / 1
12
0.00%
0 / 10
 getFileName()
0.00%
0 / 1
2
0.00%
0 / 4
 getScenarioText($format = 'text')
0.00%
0 / 1
6
0.00%
0 / 5
 getFeature()
0.00%
0 / 1
2
0.00%
0 / 3
 toString()
0.00%
0 / 1
2
0.00%
0 / 4
 preload()
0.00%
0 / 1
6
0.00%
0 / 7
 testCodecept()
0.00%
0 / 1
12
0.00%
0 / 14
<?php
namespace Codeception\TestCase;
use Codeception\Event\Fail;
use Codeception\Event\Test;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Codeception\Step;
class Cept extends \Codeception\TestCase
{
private $name;
protected $testfile = null;
protected $output;
protected $debug;
protected $features = array();
protected $bootstrap = null;
protected $stopped = false;
protected $dispatcher;
public function __construct(EventDispatcher $dispatcher, array $data = array(), $dataName = '')
{
parent::__construct('testCodecept', $data, $dataName);
$this->dispatcher = $dispatcher;
if (!isset($data['file'])) throw new \Exception('File with test scenario not set. Use array(file => filepath) to set a scenario');
$this->name = $data['name'];
$this->scenario = new \Codeception\Scenario($this);
$this->testfile = $data['file'];
$this->bootstrap = isset($data['bootstrap']) ? $data['bootstrap'] : null;
}
public function getFileName()
{
return $this->name;
}
public function getScenarioText($format = 'text')
{
if ($format == 'html') return $this->scenario->getHtml();
return $this->scenario->getText();
}
public function getFeature() {
return $this->scenario->getFeature();
}
public function toString()
{
return $this->scenario->getFeature() . ' (' . $this->getFileName() . ')';
}
public function preload()
{
$scenario = $this->scenario;
// preload
if (file_exists($this->bootstrap)) require $this->bootstrap;
require $this->testfile;
$this->fire('test.parsed', new Test($this));
}
public function testCodecept()
{
$scenario = $this->scenario;
$this->fire('test.before', new Test($this));
$scenario->run();
if (file_exists($this->bootstrap)) require $this->bootstrap;
try {
require $this->testfile;
} catch (\Exception $e) {
$this->fire('test.after', new Test($this));
throw $e;
}
$this->fire('test.after', new Test($this));
}
}