本文整理汇总了PHP中Behat\Behat\Hook\Scope\BeforeScenarioScope类的典型用法代码示例。如果您正苦于以下问题:PHP BeforeScenarioScope类的具体用法?PHP BeforeScenarioScope怎么用?PHP BeforeScenarioScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BeforeScenarioScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gatherContexts
/**
* @param BeforeScenarioScope $scope
*
* @BeforeScenario
*/
public function gatherContexts(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$this->minkContext = $environment->getContext('Behat\\MinkExtension\\Context\\MinkContext');
$this->jsonContext = $environment->getContext('Sanpi\\Behatch\\Context\\JsonContext');
$this->restContext = $environment->getContext('Sanpi\\Behatch\\Context\\RestContext');
}
示例2: linkUsedSubcontexts
/**
* @BeforeScenario
*/
public function linkUsedSubcontexts(BeforeScenarioScope $scope)
{
$this->placeholders = $scope->getEnvironment()->getContext('AppBundle\\Behat\\PlaceholderContext');
if ($scope->getEnvironment()->hasContextClass('Behat\\MinkExtension\\Context\\MinkContext')) {
$this->mink = $scope->getEnvironment()->getContext('Behat\\MinkExtension\\Context\\MinkContext');
}
}
示例3: gatherContexts
/** @BeforeScenario */
public function gatherContexts(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$this->flowContext = $environment->getContext('T3DD\\Backend\\Tests\\Behat\\FlowContext');
$this->webApiContext = $environment->getContext('Behat\\WebApiExtension\\Context\\WebApiContext');
$this->objectManager = $this->flowContext->getObjectManager();
}
示例4: init
/**
* @BeforeScenario
*/
public function init(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$this->gridContext = $environment->getContext(GridWebContext::class);
$this->resourceContext = $environment->getContext(ResourceWebContext::class);
$this->routingContext = $environment->getContext(RoutingContext::class);
}
示例5: registerScenario
/**
* @BeforeScenario
*/
public function registerScenario(BeforeScenarioScope $scope)
{
// Scenario not usually available to steps, so we do ourselves.
// See issue
$this->scenario = $scope->getScenario();
//print $this->scenario->getTitle();
}
示例6: gatherContext
/** Fetch the behat environment.
*
* @BeforeScenario
*
* @param scope
*/
public function gatherContext(BeforeScenarioScope $scope)
{
$this->minkContext = $scope->getEnvironment()->getContext($this->contextName);
if (!$this->minkContext) {
$message = sprintf("Unable to fetch the required context: %s", $this->contextName);
throw new ExpectationException($message, null);
}
}
示例7: gatherContexts
/** @BeforeScenario */
public function gatherContexts(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$this->minkContext = $environment->getContext('Sfynx\\BehatBundle\\Behat\\MinkExtension\\Context\\MinkContext');
$this->ajaxsubcontext = $environment->getContext('Sfynx\\BehatBundle\\Behat\\MinkExtension\\Context\\SubContext\\AjaxContext');
$this->hiddenfieldsubcontext = $environment->getContext('Sfynx\\BehatBundle\\Behat\\MinkExtension\\Context\\SubContext\\HiddenFieldSubContext');
$this->xpathxubcontext = $environment->getContext('Sfynx\\BehatBundle\\Behat\\MinkExtension\\Context\\SubContext\\XpathSubContext');
}
示例8: gatherContexts
/**
* This is used to load in the different contexts so they can be used with in the class
*
* @param BeforeScenarioScope $scope
*
* @BeforeScenario
*/
public function gatherContexts(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$contexts = $this->_getArrayOfContexts();
foreach ($contexts as $context => $classVar) {
$this->{$classVar} = $environment->getContext($context);
}
}
示例9: connectToAPIContext
/**
* Simple provider for the API context.
*
* @param BeforeScenarioScope $scenarioScope
*
* @return ApiContext
*/
public static function connectToAPIContext(BeforeScenarioScope $scenarioScope)
{
$environment = $scenarioScope->getEnvironment();
if (!$environment instanceof InitializedContextEnvironment) {
throw new \RuntimeException(sprintf('Cannot run tests as current feature context needs to access `ApiContext`, but for that "%s" is needed!', InitializedContextEnvironment::class));
}
return $environment->getContext(ApiContext::class);
}
示例10: beforeScenario
/**
* Perform before scenario actions:
* - Gather all contexts so they can be reused in the current context.
*
* @BeforeScenario
*/
public function beforeScenario(BeforeScenarioScope $scope)
{
// Gather all contexts.
$contexts = $scope->getEnvironment()->getContexts();
foreach ($contexts as $context) {
$context_class_name = get_class($context);
$this->contexts[$context_class_name] = $context;
}
}
示例11: gatherContexts
/**
* @BeforeScenario
*/
public function gatherContexts(BeforeScenarioScope $scope)
{
foreach ($scope->getEnvironment()->getContexts() as $context) {
if ($context instanceof SubContext) {
$context->setMainContext($this);
$this->contexts[$context->getName()] = $context;
}
}
$this->session = $this->getSession();
}
示例12: gatherContexts
/**
* @BeforeScenario
*/
public function gatherContexts(BeforeScenarioScope $scope)
{
/** @var Environment $environment */
$environment = $scope->getEnvironment();
// Inject the specific contexts so they can be reused here.
foreach ($this->contexts_map as $key => $class) {
$context = $environment->getContext($class);
$this->contexts[$key] = $context;
unset($this->contexts_map[$key]);
}
}
示例13: prepareParameters
/**
* @BeforeScenario
*
* Enable the testing app before the first scenario of the feature and
* reset the configs before each scenario
* @param BeforeScenarioScope $event
*/
public function prepareParameters(BeforeScenarioScope $event)
{
$user = $this->currentUser;
$this->currentUser = 'admin';
$scenarios = $event->getFeature()->getScenarios();
if ($event->getScenario() === reset($scenarios)) {
$this->setStatusTestingApp(true);
}
$this->resetAppConfigs();
$this->currentUser = $user;
}
示例14: gatherContexts
/** @BeforeScenario */
public function gatherContexts(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
foreach ($environment->getContexts() as $context) {
if ($context instanceof \Behat\MinkExtension\Context\RawMinkContext) {
$context->getSession('default')->setRequestHeader('Accept', 'text/html');
$username = $this->kernel->getContainer()->getParameter('api_wtw_repositories_user_name_super');
$password = $this->kernel->getContainer()->getParameter('api_wtw_repositories_password');
$context->getSession('default')->setBasicAuth($username, $password);
}
}
}
示例15: before
/**
* @BeforeScenario
*/
public function before(BeforeScenarioScope $scope)
{
if (!self::$isPrepared) {
$this->prepare();
self::$isPrepared = true;
}
// Scenario skips a line so it's not a new example
if ($scope->getScenario()->getLine() !== self::$lastScenarioLine + 1) {
$this->reset();
}
self::$lastScenarioLine = $scope->getScenario()->getLine();
return;
}