Code Duplication    Length = 15-16 lines in 2 locations

src/SilverStripe/BehatExtension/Context/SilverStripeContext.php 2 locations

@@ 349-364 (lines=16) @@
346
	 * Fills in form field with specified id|name|label|value.
347
	 * Overwritten to select the first *visible* element, see https://github.com/Behat/Mink/issues/311
348
	 */
349
	public function fillField($field, $value) {
350
		$value = $this->fixStepArgument($value);
351
		$fields = $this->getSession()->getPage()->findAll('named', array(
352
			'field', $this->getSession()->getSelectorsHandler()->xpathLiteral($field)
353
		));
354
		if($fields) foreach($fields as $f) {
355
			if($f->isVisible()) {
356
				$f->setValue($value);
357
				return;
358
			}
359
		}
360
361
		throw new ElementNotFoundException(
362
			$this->getSession(), 'form field', 'id|name|label|value', $field
363
		);
364
	}
365
366
	/**
367
	 * Overwritten to click the first *visable* link the DOM.
@@ 369-383 (lines=15) @@
366
	/**
367
	 * Overwritten to click the first *visable* link the DOM.
368
	 */
369
	public function clickLink($link) {
370
		$link = $this->fixStepArgument($link);
371
		$links = $this->getSession()->getPage()->findAll('named', array(
372
			'link', $this->getSession()->getSelectorsHandler()->xpathLiteral($link)
373
		));
374
		if($links) foreach($links as $l) {
375
			if($l->isVisible()) {
376
				$l->click();
377
				return;
378
			}
379
		}
380
		throw new ElementNotFoundException(
381
			$this->getSession(), 'link', 'id|name|label|value', $link
382
		);
383
	}
384
385
	 /**
386
	 * Sets the current date. Relies on the underlying functionality using