当前位置: 首页>>代码示例>>PHP>>正文


PHP BeforeScenarioScope::getEnvironment方法代码示例

本文整理汇总了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();
 }
开发者ID:edmondscommerce,项目名称:behat-error-detection-context,代码行数:13,代码来源:ErrorDetectionContext.php

示例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');
     }
 }
开发者ID:TomasJancauskas,项目名称:HR,代码行数:10,代码来源:BaseContext.php

示例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');
 }
开发者ID:soixante,项目名称:service-agora,代码行数:12,代码来源:FeatureContext.php

示例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();
 }
开发者ID:HofUniversityIWS,项目名称:backend,代码行数:8,代码来源:FeatureContext.php

示例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);
 }
开发者ID:php-lug,项目名称:lug,代码行数:10,代码来源:LocaleWebContext.php

示例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);
     }
 }
开发者ID:adrianbroher,项目名称:thwboard,代码行数:14,代码来源:HTMLValidateContext.php

示例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);
 }
开发者ID:sententiaregum,项目名称:sententiaregum,代码行数:15,代码来源:ContextHelper.php

示例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);
     }
 }
开发者ID:edmondscommerce,项目名称:behat-magento-2-context,代码行数:15,代码来源:AbstractMagentoContext.php

示例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');
 }
开发者ID:pigroupe,项目名称:SfynxBehatBundle,代码行数:9,代码来源:FeatureContext.php

示例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;
     }
 }
开发者ID:stevebresnick,项目名称:iomedia_stp_d7_core,代码行数:15,代码来源:FeatureContext.php

示例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();
 }
开发者ID:apalethorpe,项目名称:pimphat,代码行数:13,代码来源:FeatureContext.php

示例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]);
     }
 }
开发者ID:testdrupal,项目名称:behatextension,代码行数:14,代码来源:RawTestDrupalContext.php

示例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);
         }
     }
 }
开发者ID:WeavingTheWeb,项目名称:devobs,代码行数:13,代码来源:FeatureContext.php

示例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);
     }
 }
开发者ID:Roomify,项目名称:roomifyextension,代码行数:18,代码来源:RoomifyContext.php

示例15: gatherContexts

 /** @BeforeScenario */
 public function gatherContexts(BeforeScenarioScope $scope)
 {
     $environment = $scope->getEnvironment();
     $this->minkContext = $environment->getContext('Knp\\FriendlyContexts\\Context\\MinkContext');
 }
开发者ID:victoire,项目名称:victoire,代码行数:6,代码来源:VictoireContext.php


注:本文中的Behat\Behat\Hook\Scope\BeforeScenarioScope::getEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。