Completed
Push — master ( 2eb923...4fd9ab )
by Jonathan
13s
created

doc/_static/snippets/subcontext.inc (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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) {
0 ignored issues
show
The parameter $arg1 is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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
}
56