From f25177aa780a3ddc28917e2937671254226cafb2 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 2 Mar 2016 10:22:30 -0500
Subject: [PATCH] Added safer wrapper method around getLink().

---
 .../VuFind/src/VuFindTest/Unit/MinkTestCase.php   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php b/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php
index edee3660c81..d9d9d3b9312 100644
--- a/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php
+++ b/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php
@@ -269,6 +269,21 @@ abstract class MinkTestCase extends DbTestCase
         return $result;
     }
 
+    /**
+     * Retrieve a link and assert that it exists before returning it.
+     *
+     * @param Element $page Page element
+     * @param string  $text Link text to match
+     *
+     * @return mixed
+     */
+    protected function findAndAssertLink(Element $page, $text)
+    {
+       $link = $page->findLink($text);
+       $this->assertTrue(is_object($link));
+       return $link;
+    }
+
     /**
      * Check whether an element containing the specified text exists.
      *
-- 
GitLab