Repository navigation
Expand file tree
/
Copy pathCept.php
More file actions
73 lines (58 loc) · 1.73 KB
/
Copy pathCept.php
File metadata and controls
73 lines (58 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace Codeception\TestCase;
use Codeception\Events;
use Codeception\Event\TestEvent;
use Codeception\Step;
use Codeception\TestCase;
class Cept extends TestCase implements
Interfaces\ScenarioDriven,
Interfaces\Descriptive,
Interfaces\Reported,
Interfaces\Plain,
Interfaces\Configurable
{
use Shared\Actor;
use Shared\ScenarioPrint;
public function __construct(array $data = array(), $dataName = '')
{
parent::__construct('testCodecept', $data, $dataName);
}
public function getSignature()
{
return ltrim(substr($this->testName, 0,-4),'\\/'); // cut ".php" in end; cut "/" in start
}
public function getName($withDataSet = true)
{
return $this->getFeature() ? $this->getFeature() : $this->testName;
}
public function getFileName()
{
return $this->testFile;
}
public function toString()
{
return $this->getFeature(). " (".$this->getSignature().")";
}
public function preload()
{
$this->parser->prepareToRun($this->getRawBody());
$this->fire(Events::TEST_PARSED, new TestEvent($this));
}
public function getRawBody()
{
return file_get_contents($this->testFile);
}
public function testCodecept()
{
$this->fire(Events::TEST_BEFORE, new TestEvent($this));
$scenario = $this->scenario;
$scenario->run();
/** @noinspection PhpIncludeInspection */
require $this->testFile;
$this->fire(Events::TEST_AFTER, new TestEvent($this));
}
public function getReportFields()
{
return ['name' => basename($this->getFileName(),'Cept.php'), 'file' => $this->getFileName(), 'feature' => $this->getFeature()];
}
}