Security update for permissions_by_term
[yaffs-website] / vendor / drupal / drupal-extension / doc / _static / snippets / subcontext.inc
1 <?php
2
3 /**
4  * Contains \FooFoo.
5  */
6
7 use Behat\Behat\Hook\Scope\BeforeScenarioScope;
8 use Behat\Behat\Tester\Exception\PendingException;
9 use Drupal\DrupalExtension\Context\DrupalSubContextBase;
10 use Drupal\DrupalExtension\Context\DrupalSubContextInterface;
11
12 /**
13  * Example subcontext.
14  */
15 class FooFoo extends DrupalSubContextBase implements DrupalSubContextInterface {
16
17   /**
18    * @var \Drupal\DrupalExtension\Context\DrupalContext
19    */
20   protected $drupalContext;
21
22   /**
23    * @var \Drupal\DrupalExtension\Context\MinkContext
24    */
25   protected $minkContext;
26
27   /**
28    * @BeforeScenario
29    */
30   public function gatherContexts(BeforeScenarioScope $scope) {
31     $environment = $scope->getEnvironment();
32
33     $this->drupalContext = $environment->getContext('Drupal\DrupalExtension\Context\DrupalContext');
34     $this->minkContext = $environment->getContext('Drupal\DrupalExtension\Context\MinkContext');
35   }
36
37   /**
38    * @Given I create a(an) :arg1 content type
39    */
40   public function CreateAContentType($arg1) {
41     $this->minkContext->assertAtPath("admin/structure/types/add");
42     $node = [
43       'title' => 'Test content!',
44     ];
45     $this->drupalContext->nodeCreate($node);
46   }
47
48   /**
49    * @Then /^I should have a subcontext definition$/
50    */
51   public function assertSubContextDefinition() {
52     throw new PendingException();
53   }
54
55 }