-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better availability of provided scenario inside tests
Better availability of provided scenario inside tests
- Loading branch information
Showing
3 changed files
with
92 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace PHPUnitBehat\Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use PHPUnit\Framework\ExpectationFailedException; | ||
use Behat\Testwork\Argument\Exception\UnknownParameterValueException; | ||
use PHPUnitBehat\TestTraits\BehatTestTrait; | ||
use Behat\Gherkin\Node\KeywordNodeInterface; | ||
use Behat\Gherkin\Node\ScenarioInterface; | ||
|
||
/** | ||
* | ||
*/ | ||
class BehatProvidingTraitTest extends TestCase { | ||
|
||
use BehatTestTrait; | ||
|
||
protected $feature = <<<'FEATURE' | ||
Feature: BehatProvidingTrait | ||
In order to test a feature | ||
We need to able provide it to phpunit | ||
Scenario: getProvidedScenario | ||
Then getProvidedScenario returns a scenario with the title "getProvidedScenario" | ||
Scenario: getProvidedFeature | ||
Then getProvidedScenario returns a scenario with the title "getProvidedFeature" | ||
Then getProvidedFeature returns a feature with the title "BehatProvidingTrait" | ||
|
||
FEATURE; | ||
|
||
|
||
/** | ||
* @Then getProvidedScenario returns a scenario with the title :title | ||
*/ | ||
public function getProvidedScenarioGets($title) { | ||
$this->assertInstanceOf(ScenarioInterface::class, $this->getProvidedScenario()); | ||
$this->assertEquals($title, $this->getProvidedScenario()->getTitle()); | ||
} | ||
|
||
/** | ||
* @Then getProvidedFeature returns a feature with the title :title | ||
*/ | ||
public function getProvidedFeatureGets($title) { | ||
$this->assertInstanceOf(KeywordNodeInterface::class, $this->getProvidedFeature()); | ||
$this->assertEquals($title, $this->getProvidedFeature()->getTitle()); | ||
} | ||
|
||
} | ||
|