Code Duplication    Length = 11-12 lines in 2 locations

src/Drupal/DrupalExtension/Context/MinkContext.php 2 locations

@@ 303-314 (lines=12) @@
300
  /**
301
   * @Then I (should )see the heading :heading
302
   */
303
  public function assertHeading($heading) {
304
    $element = $this->getSession()->getPage();
305
    foreach (array('h1', 'h2', 'h3', 'h4', 'h5', 'h6') as $tag) {
306
      $results = $element->findAll('css', $tag);
307
      foreach ($results as $result) {
308
        if ($result->getText() == $heading) {
309
          return;
310
        }
311
      }
312
    }
313
    throw new \Exception(sprintf("The text '%s' was not found in any heading on the page %s", $heading, $this->getSession()->getCurrentUrl()));
314
  }
315
316
  /**
317
   * @Then I (should )not see the heading :heading
@@ 319-329 (lines=11) @@
316
  /**
317
   * @Then I (should )not see the heading :heading
318
   */
319
  public function assertNotHeading($heading) {
320
    $element = $this->getSession()->getPage();
321
    foreach (array('h1', 'h2', 'h3', 'h4', 'h5', 'h6') as $tag) {
322
      $results = $element->findAll('css', $tag);
323
      foreach ($results as $result) {
324
        if ($result->getText() == $heading) {
325
          throw new \Exception(sprintf("The text '%s' was found in a heading on the page %s", $heading, $this->getSession()->getCurrentUrl()));
326
        }
327
      }
328
    }
329
  }
330
331
  /**
332
   * @Then I (should ) see the button :button