Blame view

vendor/codeception/base/tests/unit/Codeception/ScenarioTest.php 1.25 KB
8ec727c1   曹明   初始化代码提交
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
<?php

class ScenarioTest extends \PHPUnit_Framework_TestCase
{
    public function testGetHtml()
    {
        $step1 = $this->getMockBuilder('\Codeception\Step')
            ->setConstructorArgs(['Do some testing', ['arg1', 'arg2']])
            ->setMethods(null)
            ->getMock();
        $step2 = $this->getMockBuilder('\Codeception\Step')
            ->setConstructorArgs(['Do even more testing without args', []])
            ->setMethods(null)
            ->getMock();

        $scenario = new \Codeception\Scenario(new \Codeception\Test\Cept('test', 'testCept.php'));
        $scenario->addStep($step1);
        $scenario->addStep($step2);
        $scenario->setFeature('Do some testing');

        $this->assertSame(
            '<h3>I WANT TO DO SOME TESTING</h3>I do some testing <span style="color: #732E81">&quot;arg1&quot;,&quot;arg2&quot;</span>'
            . '<br/>I do even more testing without args<br/>',
            $scenario->getHtml()
        );
    }

    public function testScenarioCurrentNameReturnsTestName()
    {
        $cept = new \Codeception\Test\Cept('successfulLogin', 'successfulLoginCept.php');
        $scenario = new \Codeception\Scenario($cept);

        $this->assertSame('successfulLogin', $scenario->current('name'));
    }
}