From c54c09bac51510b8cf14218f50f943a36a31ea78 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Wed, 3 May 2017 15:18:48 -0400 Subject: [PATCH] Adjusted tests to match revised strings. --- .../src/VuFindTest/Mink/IlsActionsTest.php | 8 ++++---- .../View/Helper/Root/ResultFeedTest.php | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/IlsActionsTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/IlsActionsTest.php index ebcfd84fc5a..e130ac88c5e 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/IlsActionsTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/IlsActionsTest.php @@ -299,7 +299,7 @@ class IlsActionsTest extends \VuFindTest\Unit\MinkTestCase ); $page = $this->gotoRecordById(); $element = $this->findCss($page, '.alert.alert-info a'); - $this->assertEquals('Login', $element->getText()); + $this->assertEquals('Login for hold and recall information', $element->getText()); $element->click(); $this->snooze(); $this->findCss($page, '.createAccountLink')->click(); @@ -368,7 +368,7 @@ class IlsActionsTest extends \VuFindTest\Unit\MinkTestCase // Log in the user on the record page: $page = $this->gotoRecordById(); $element = $this->findCss($page, '.alert.alert-info a'); - $this->assertEquals('Login', $element->getText()); + $this->assertEquals('Login for hold and recall information', $element->getText()); $element->click(); $this->snooze(); $this->fillInLoginForm($page, 'username1', 'test', false); @@ -433,7 +433,7 @@ class IlsActionsTest extends \VuFindTest\Unit\MinkTestCase // Log in the user on the record page: $page = $this->gotoRecordById(); $element = $this->findCss($page, '.alert.alert-info a'); - $this->assertEquals('Login', $element->getText()); + $this->assertEquals('Login for hold and recall information', $element->getText()); $element->click(); $this->snooze(); $this->fillInLoginForm($page, 'username1', 'test', false); @@ -469,7 +469,7 @@ class IlsActionsTest extends \VuFindTest\Unit\MinkTestCase // Log in the user on the record page: $page = $this->gotoRecordById(); $element = $this->findCss($page, '.alert.alert-info a'); - $this->assertEquals('Login', $element->getText()); + $this->assertEquals('Login for hold and recall information', $element->getText()); $element->click(); $this->snooze(); $this->fillInLoginForm($page, 'username1', 'test', false); diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/View/Helper/Root/ResultFeedTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/View/Helper/Root/ResultFeedTest.php index 4ca952a9cc6..5d581bdeca4 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/View/Helper/Root/ResultFeedTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/View/Helper/Root/ResultFeedTest.php @@ -86,6 +86,21 @@ class ResultFeedTest extends \VuFindTest\Unit\ViewHelperTestCase ]; } + /** + * Mock out the translator. + * + * @return \Zend\I18n\Translator\TranslatorInterface + */ + protected function getMockTranslator() + { + $mock = $this->getMockBuilder('Zend\I18n\Translator\TranslatorInterface') + ->getMock(); + $mock->expects($this->at(1))->method('translate') + ->with($this->equalTo('showing_results_of_html'), $this->equalTo('default')) + ->will($this->returnValue('Showing <strong>%%start%% - %%end%%</strong> results of <strong>%%total%%</strong>')); + return $mock; + } + /** * Test feed generation * @@ -107,6 +122,7 @@ class ResultFeedTest extends \VuFindTest\Unit\ViewHelperTestCase $results->getParams()->initFromRequest($request); $helper = new ResultFeed(); + $helper->setTranslator($this->getMockTranslator()); $helper->setView($this->getPhpRenderer($this->getPlugins())); $feed = $helper->__invoke($results, '/test/path'); $this->assertTrue(is_object($feed)); @@ -121,7 +137,7 @@ class ResultFeedTest extends \VuFindTest\Unit\ViewHelperTestCase // Now re-parse it and check for some expected values: $parsedFeed = \Zend\Feed\Reader\Reader::importString($rss); $this->assertEquals( - 'Showing 1-2 of 2', $parsedFeed->getDescription() + 'Showing 1 - 2 results of 2', $parsedFeed->getDescription() ); $items = []; $i = 0; -- GitLab