Code Duplication    Length = 11-12 lines in 2 locations

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

@@ 271-282 (lines=12) @@
268
  /**
269
   * @Then I (should )see the heading :heading
270
   */
271
  public function assertHeading($heading) {
272
    $element = $this->getSession()->getPage();
273
    foreach (array('h1', 'h2', 'h3', 'h4', 'h5', 'h6') as $tag) {
274
      $results = $element->findAll('css', $tag);
275
      foreach ($results as $result) {
276
        if ($result->getText() == $heading) {
277
          return;
278
        }
279
      }
280
    }
281
    throw new \Exception(sprintf("The text '%s' was not found in any heading on the page %s", $heading, $this->getSession()->getCurrentUrl()));
282
  }
283
284
  /**
285
   * @Then I (should )not see the heading :heading
@@ 287-297 (lines=11) @@
284
  /**
285
   * @Then I (should )not see the heading :heading
286
   */
287
  public function assertNotHeading($heading) {
288
    $element = $this->getSession()->getPage();
289
    foreach (array('h1', 'h2', 'h3', 'h4', 'h5', 'h6') as $tag) {
290
      $results = $element->findAll('css', $tag);
291
      foreach ($results as $result) {
292
        if ($result->getText() == $heading) {
293
          throw new \Exception(sprintf("The text '%s' was found in a heading on the page %s", $heading, $this->getSession()->getCurrentUrl()));
294
        }
295
      }
296
    }
297
  }
298
299
  /**
300
   * @Then I (should ) see the button :button