本文整理汇总了PHP中Behat\Behat\Hook\Scope\BeforeScenarioScope::getScenario方法的典型用法代码示例。如果您正苦于以下问题:PHP BeforeScenarioScope::getScenario方法的具体用法?PHP BeforeScenarioScope::getScenario怎么用?PHP BeforeScenarioScope::getScenario使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behat\Behat\Hook\Scope\BeforeScenarioScope
的用法示例。
在下文中一共展示了BeforeScenarioScope::getScenario方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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();
}
示例4: 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;
}
示例5: beforeScenario
/**
* @param BeforeScenarioScope $scope
*
* @BeforeScenario
*/
public function beforeScenario(BeforeScenarioScope $scope)
{
$this->tags += array_merge($scope->getFeature()->getTags(), $scope->getScenario()->getTags());
// Any page should be visited due to using jQuery and checking the cookies.
$this->getSession()->visit($this->locatePath('/'));
}
示例6: getCoverageKeyFromScope
private function getCoverageKeyFromScope(BeforeScenarioScope $scope)
{
$name = $scope->getFeature()->getTitle() . '::' . $scope->getScenario()->getTitle();
return $name;
}
示例7: registerScenario
/**
* @BeforeScenario
*/
public function registerScenario(BeforeScenarioScope $scope)
{
// Scenario not usually available to steps, so we do ourselves.
$this->scenario = $scope->getScenario();
$this->environment = $scope->getEnvironment();
}
示例8: start
/**
* @BeforeScenario
* @param BeforeScenarioScope $event
*/
public function start(BeforeScenarioScope $event)
{
self::$coverage->start($event->getScenario()->getTitle());
}
示例9: beforeScenario
/**
* @param Scope\BeforeScenarioScope $scope
*
* @BeforeScenario
*/
public function beforeScenario(Scope\BeforeScenarioScope $scope)
{
foreach (array_merge($scope->getFeature()->getTags(), $scope->getScenario()->getTags()) as $tag) {
$values = explode(':', $tag);
$value = '';
if (count($values) > 1) {
list($tag, $value) = $values;
}
self::$tags[strtolower($tag)] = $value;
}
// Any page should be visited due to using jQuery and checking the cookies.
$this->visitPath('/');
// By "Goutte" session we need to visit any page to be able to set a cookie
// for this session and use it for checking request status codes.
$this->visitPath('/', 'goutte');
}
示例10: startCoverage
/**
* @BeforeScenario
*/
public function startCoverage(BeforeScenarioScope $scope)
{
self::$coverage->start("{$scope->getFeature()->getTitle()}::{$scope->getScenario()->getTitle()}");
}
示例11: beforeScenario
/**
* @param Scope\BeforeScenarioScope $scope
* Scope of the processing scenario.
*
* @BeforeScenario
*/
public function beforeScenario(Scope\BeforeScenarioScope $scope)
{
self::collectTags($scope->getScenario()->getTags());
// No need to keep working element between scenarios.
$this->unsetWorkingElement();
// Any page should be visited due to using jQuery and checking the cookies.
$this->visitPath('/');
// By "Goutte" session we need to visit any page to be able to set a cookie
// for this session and use it for checking request status codes.
$this->visitPath('/', 'goutte');
}
示例12: gatherContexts
/**
* @BeforeScenario
*
* Allow access to the MinkContext.
*/
public function gatherContexts(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$this->minkContext = $environment->getContext('Drupal\\DrupalExtension\\Context\\MinkContext');
$this->currentScenario = $scope->getScenario();
$this->scenarioName = $this->currentScenario->getTitle();
}
示例13: setCurrentScenarioLine
/**
* set scenario line number to make screenshots for background steps
*
* @BeforeScenario
*
* @param BeforeScenarioScope $scope [description]
*
* @return null
*/
public function setCurrentScenarioLine(BeforeScenarioScope $scope)
{
$this->currentScenarioLineNumber = $scope->getScenario()->getLine();
}
示例14: getCoverageKeyFromScope
private function getCoverageKeyFromScope(BeforeScenarioScope $scope) : string
{
return sprintf('%s::%s', $scope->getFeature()->getTitle(), $scope->getScenario()->getTitle());
}