ScenarioTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. class ScenarioTest extends \PHPUnit\Framework\TestCase
  3. {
  4. public function testGetHtml()
  5. {
  6. $step1 = $this->getMockBuilder('\Codeception\Step')
  7. ->setConstructorArgs(['Do some testing', ['arg1', 'arg2']])
  8. ->setMethods(null)
  9. ->getMock();
  10. $step2 = $this->getMockBuilder('\Codeception\Step')
  11. ->setConstructorArgs(['Do even more testing without args', []])
  12. ->setMethods(null)
  13. ->getMock();
  14. $scenario = new \Codeception\Scenario(new \Codeception\Test\Cept('test', 'testCept.php'));
  15. $scenario->addStep($step1);
  16. $scenario->addStep($step2);
  17. $scenario->setFeature('Do some testing');
  18. $this->assertSame(
  19. '<h3>I WANT TO DO SOME TESTING</h3>I do some testing <span style="color: #732E81">&quot;arg1&quot;,&quot;arg2&quot;</span>'
  20. . '<br/>I do even more testing without args<br/>',
  21. $scenario->getHtml()
  22. );
  23. }
  24. public function testScenarioCurrentNameReturnsTestName()
  25. {
  26. $cept = new \Codeception\Test\Cept('successfulLogin', 'successfulLoginCept.php');
  27. $scenario = new \Codeception\Scenario($cept);
  28. $this->assertSame('successfulLogin', $scenario->current('name'));
  29. }
  30. }