本文整理汇总了PHP中Behat\Behat\Hook\Scope\BeforeScenarioScope::getEnvironment方法的典型用法代码示例。如果您正苦于以下问题:PHP BeforeScenarioScope::getEnvironment方法的具体用法?PHP BeforeScenarioScope::getEnvironment怎么用?PHP BeforeScenarioScope::getEnvironment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behat\Behat\Hook\Scope\BeforeScenarioScope
的用法示例。
在下文中一共展示了BeforeScenarioScope::getEnvironment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeScenario
/**
*
* @BeforeScenario
*
* @param BeforeScenarioScope $scope
*/
public function beforeScenario(BeforeScenarioScope $scope)
{
$this->scenarioData = ['file' => $scope->getFeature()->getFile(), 'line' => $scope->getScenario()->getLine(), 'title' => $scope->getScenario()->getTitle(), 'tags' => $scope->getScenario()->getTags()];
$this->_w3c = $scope->getEnvironment()->getContext(W3CValidationContext::class);
$this->_screenshot = $scope->getEnvironment()->getContext(ScreenshotContext::class);
$this->setLogPath();
}
示例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
/**
* @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');
}
示例4: 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();
}
示例5: 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);
}
示例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: 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);
}
示例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: 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');
}
示例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: 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);
}
}
}
示例14: before
/**
* @BeforeScenario
*/
public function before(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$this->minkContext = $environment->getContext('Drupal\\DrupalExtension\\Context\\MinkContext');
if (module_exists('maillog')) {
$this->maillog_last_id = (int) db_query('SELECT MAX(idmaillog) FROM {maillog}')->fetchField();
// maillog configuration
variable_set('maillog_send', 0);
variable_set('maillog_log', 1);
variable_set('maillog_devel', 0);
// Set the the maillog handler in all mail system types
$mail_system = array('default-system' => 'MaillogMailSystem', 'htmlmail' => 'MaillogMailSystem', 'variable_email' => 'MaillogMailSystem', 'maillog' => 'MaillogMailSystem');
variable_set('mail_system', $mail_system);
}
}
示例15: gatherContexts
/** @BeforeScenario */
public function gatherContexts(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$this->minkContext = $environment->getContext('Knp\\FriendlyContexts\\Context\\MinkContext');
}