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
<?php
namespace Codeception\Test\Feature;
use Codeception\Lib\Parser;
use Codeception\Scenario;
use Codeception\Test\Metadata;
trait ScenarioLoader
{
    /**
     * @var Scenario
     */
    private $scenario;
    /**
     * @return Metadata
     */
    abstract public function getMetadata();
    protected function createScenario()
    {
        $this->scenario = new Scenario($this);
    }
    /**
     * @return Scenario
     */
    public function getScenario()
    {
        return $this->scenario;
    }
    public function getFeature()
    {
        return $this->getScenario()->getFeature();
    }
    public function getScenarioText($format = 'text')
    {
        $code = $this->getSourceCode();
        $this->getParser()->parseFeature($code);
        $this->getParser()->parseSteps($code);
        if ($format == 'html') {
            return $this->getScenario()->getHtml();
        }
        return $this->getScenario()->getText();
    }
    /**
     * @return Parser
     */
    abstract protected function getParser();
    abstract public function getSourceCode();
}