Code Duplication    Length = 15-16 lines in 2 locations

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

@@ 375-390 (lines=16) @@
372
     * Fills in form field with specified id|name|label|value.
373
     * Overwritten to select the first *visible* element, see https://github.com/Behat/Mink/issues/311
374
     */
375
    public function fillField($field, $value)
376
    {
377
        $value = $this->fixStepArgument($value);
378
        $fields = $this->getSession()->getPage()->findAll('named', array(
379
            'field', $this->getSession()->getSelectorsHandler()->xpathLiteral($field)
380
        ));
381
        if ($fields) {
382
            foreach ($fields as $f) {
383
                if ($f->isVisible()) {
384
                    $f->setValue($value);
385
                    return;
386
                }
387
            }
388
        }
389
390
        throw new ElementNotFoundException(
391
            $this->getSession(),
392
            'form field',
393
            'id|name|label|value',
@@ 401-415 (lines=15) @@
398
    /**
399
     * Overwritten to click the first *visable* link the DOM.
400
     */
401
    public function clickLink($link)
402
    {
403
        $link = $this->fixStepArgument($link);
404
        $links = $this->getSession()->getPage()->findAll('named', array(
405
            'link', $this->getSession()->getSelectorsHandler()->xpathLiteral($link)
406
        ));
407
        if ($links) {
408
            foreach ($links as $l) {
409
                if ($l->isVisible()) {
410
                    $l->click();
411
                    return;
412
                }
413
            }
414
        }
415
        throw new ElementNotFoundException(
416
            $this->getSession(),
417
            'link',
418
            'id|name|label|value',