From 1d5e0d69251b190a26c9e6ab021f68cb60791b85 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 2 Feb 2016 15:01:16 -0500 Subject: [PATCH] Add utility method. --- .../src/VuFindTest/Unit/MinkTestCase.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php b/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php index 5177d8ce45c..5823ebe4245 100644 --- a/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php +++ b/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php @@ -258,6 +258,25 @@ abstract class MinkTestCase extends DbTestCase return $result; } + /** + * Check whether an element containing the specified text exists. + * + * @param Element $page Page element + * @param string $selector CSS selector + * @param string $text Expected text + * + * @return bool + */ + protected function hasElementsMatchingText(Element $page, $selector, $text) + { + foreach ($page->findAll('css', $selector) as $current) { + if ($text === $current->getText()) { + return true; + } + } + return false; + } + /** * Standard setup method. * -- GitLab