Completed
Push — 1.0.x ( 0a17d9...7f19ee )
by Antonio
06:30
created

RawMinkContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertElementType() 0 5 2
1
<?php
2
3
namespace NuvoleWeb\Drupal\DrupalExtension\Context;
4
5
use Behat\Mink\Element\NodeElement;
6
use Behat\Mink\Exception\ExpectationException;
7
use Behat\MinkExtension\Context\RawMinkContext as OriginalRawMinkContext;
8
9
/**
10
 * Class RawMinkContext.
11
 *
12
 * @package NuvoleWeb\Drupal\DrupalExtension\Context
13
 */
14
class RawMinkContext extends OriginalRawMinkContext {
15
16
  /**
17
   * Checks that the given element is of the given type.
18
   *
19
   * @param NodeElement $element
20
   *   The element to check.
21
   * @param string $type
22
   *   The expected type.
23
   *
24
   * @throws ExpectationException
25
   *   Thrown when the given element is not of the expected type.
26
   */
27
  public function assertElementType(NodeElement $element, $type) {
28
    if ($element->getTagName() !== $type) {
29
      throw new ExpectationException("The element is not a '$type'' field.", $this->getSession());
30
    }
31
  }
32
33
}
34