Created
January 28, 2013 12:23
-
-
Save marijn/4655089 to your computer and use it in GitHub Desktop.
Example organization of context files in Behat.
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
<?php | |
use Behat\Behat\Context\BehatContext; | |
final class CustomerContext extends BehatContext | |
{ | |
// ... your step definitions related to customer | |
} |
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
<?php | |
require_once "PHPUnit/Framework/Assert/Functions.php"; | |
use Behat\Behat\Context\BehatContext; | |
final class FeatureContext extends BehatContext | |
{ | |
public function __construct(array $parameters = array()) | |
{ | |
// customer context contains all the step definitions related to customer role | |
$this->useContext('customer', new CustomerContext()); | |
// merchant context contains all the step definitions related to merchant role | |
$this->useContext('merchant', new MerchantContext($parameters['merchant_id'])); | |
} | |
} |
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
<?php | |
use Behat\Behat\Context\BehatContext; | |
final class MerchantContext extends BehatContext | |
{ | |
private $merchantId; | |
public function __construct($merchantId) | |
{ | |
$this->merchantId = $merchantId; | |
} | |
// ... your step definitions related to merchant | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment