diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a119ecf76c682d7192ba99ef8ef95ad16494033b --- /dev/null +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php @@ -0,0 +1,408 @@ +<?php +/** + * DefaultRecord Record Driver Test Class + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category VuFind + * @package Tests + * @author Demian Katz <demian.katz@villanova.edu> + * @author Sravanthi Adusumilli <vufind-tech@lists.sourceforge.net> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + */ +namespace VuFindTest\RecordDriver; + +use VuFind\RecordDriver\DefaultRecord; +use VuFind\RecordDriver\Response\PublicationDetails; + +/** + * DefaultRecord Record Driver Test Class + * + * @category VuFind + * @package Tests + * @author Demian Katz <demian.katz@villanova.edu> + * @author Sravanthi Adusumilli <vufind-tech@lists.sourceforge.net> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + */ +class DefaultRecordTest extends \VuFindTest\Unit\TestCase +{ + /** + * Test getPublicationDates for a record. + * + * @return void + */ + public function testGetPublicationDates() + { + $pubDates = ['1992']; + $this->assertEquals($pubDates, $this->getDriver()->getPublicationDates()); + } + + /** + * Test getCoordinateLabels for a record. + * + * @return void + */ + public function testGetCoordinateLabels() + { + $coordinateLabels = []; + $this->assertEquals($coordinateLabels, $this->getDriver()->getCoordinateLabels()); + } + + /** + * Test getDisplayCoordinates for a record. + * + * @return void + */ + public function testGetDisplayCoordinates() + { + $displayCoordinates = []; + $this->assertEquals($displayCoordinates, $this->getDriver()->getDisplayCoordinates()); + } + + /** + * Test getDisplayCoordinates for a record. + * + * @return void + */ + public function testGetGeoLocation() + { + $geoLoc = []; + $this->assertEquals($geoLoc, $this->getDriver()->getGeoLocation()); + } + + /** + * Test getSchemaOrgFormats for a record. + * + * @return void + */ + public function testGetSchemaOrgFormats() + { + $formats = "Book"; + $this->assertEquals($formats, $this->getDriver()->getSchemaOrgFormats()); + } + + /** + * Test getSortTitle for a record. + * + * @return void + */ + public function testGetSortTitle() + { + $this->assertEquals("congiura dei principi napoletani 1701 :(prima e seconda stesura)", $this->getDriver()->getSortTitle()); + } + + /** + * Test getContainerReference for a record. + * + * @return void + */ + public function testGetContainerReference() + { + $this->assertEquals("", $this->getDriver()->getContainerReference()); + } + + /** + * Test getThumbnail for a record. + * + * @return void + */ + public function testGetThumbnail() + { + $thumbnail = [ + 'author' => 'Vico, Giambattista, 1668-1744.', + 'callnumber' => '', + 'size' => 'small', + 'title' => 'La congiura dei Principi Napoletani 1701 : (prima e seconda stesura) /', + 'recordid' => 'testbug2', + 'source' => 'Solr', + 'isbn' => '8820737493', + 'oclc' => '30585539']; + $this->assertEquals($thumbnail, $this->getDriver()->getThumbnail()); + } + + /** + * Test getURLs for a record. + * + * @return void + */ + public function testGetURLs() + { + $testURL = [['url' => "http://fictional.com/sample/url"]]; + $this->assertEquals($testURL, $this->getDriver()->getURLs()); + } + + /** + * Test getURLs for a record. + * + * @return void + */ + public function testGetTOC() + { + $this->assertEquals([], $this->getDriver()->getTOC()); + } + + /** + * Test getSummary for a record. + * + * @return void + */ + public function testGetSummary() + { + $this->assertEquals([], $this->getDriver()->getSummary()); + } + + /** + * Test getSubtitle for a record. + * + * @return void + */ + public function testGetSubtitle() + { + $this->assertEquals('(prima e seconda stesura) /', $this->getDriver()->getSubtitle()); + } + + /** + * Test getSecondaryAuthorsRoles for a record. + * + * @return void + */ + public function testGetSecondaryAuthorsRoles() + { + $this->assertEquals([], $this->getDriver()->getSecondaryAuthorsRoles()); + } + + /** + * Test getSecondaryAuthors for a record. + * + * @return void + */ + public function testGetSecondaryAuthors() + { + $author2 = ["Pandolfi, Claudia."]; + $this->assertEquals($author2, $this->getDriver()->getSecondaryAuthors()); + } + + /** + * Test getPublicationDetails for a record. + * + * @return void + */ + public function testGetPublicationDetails() + { + $pubDetails = [new PublicationDetails("", "Centro di Studi Vichiani,", "1992")]; + $this->assertEquals($pubDetails, $this->getDriver()->getPublicationDetails()); + } + + /** + * Test getPrimaryAuthorsRoles for a record. + * + * @return void + */ + public function testGetPrimaryAuthorsRoles() + { + $this->assertEquals([], $this->getDriver()->getPrimaryAuthorsRoles()); + } + + /** + * Test getPrimaryAuthor for a record. + * + * @return void + */ + public function testGetPrimaryAuthor() + { + $this->assertEquals("Vico, Giambattista, 1668-1744.", $this->getDriver()->getPrimaryAuthor()); + } + + /** + * Test getPreviousTitles for a record. + * + * @return void + */ + public function testGetPreviousTitles() + { + $this->assertEquals([], $this->getDriver()->getPreviousTitles()); + } + + /** + * Test getPhysicalDescriptions for a record. + * + * @return void + */ + public function testGetPhysicalDescriptions() + { + $physical[0] = "296 p. : ill. ; 24 cm."; + $this->assertEquals($physical, $this->getDriver()->getPhysicalDescriptions()); + } + + /** + * Test getCoinsOpenUrl for a record. + * + * @return void + */ + public function testGetCoinsOpenUrl() + { + $coinsOpenUrl = "url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3A" + . "UTF-8&rfr_id=info%3Asid%2Fvufind.svn.sourceforge.net%3Agenerator&rft.title=La+co" + . "ngiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F&rft.da" + . "te=1992&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitl" + . "e=La+congiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F" + . "&rft.series=Vico%2C+Giambattista%2C+1668-1744.+Works.+1982+%3B&rft.au=Vico%2C+Gi" + . "ambattista%2C+1668-1744.&rft.pub=Centro+di+Studi+Vichiani%2C&rft.edition=Fiction" + . "al+edition.&rft.isbn=8820737493"; + $this->assertEquals($coinsOpenUrl, $this->getDriver()->getCoinsOpenUrl()); + } + + /** + * Test getNewerTitles for a record. + * + * @return void + */ + public function testGetNewerTitles() + { + $this->assertEquals([], $this->getDriver()->getNewerTitles()); + } + + /** + * Test getLCCN for a record. + * + * @return void + */ + public function testGetLCCN() + { + $this->assertEquals("", $this->getDriver()->getLCCN()); + } + + /** + * Test getInstitutions for a record. + * + * @return void + */ + public function testGetInstitutions() + { + $institution = ["MyInstitution"]; + $this->assertEquals($institution, $this->getDriver()->getInstitutions()); + } + + /** + * Test getLastIndexed for a record. + * + * @return void + */ + public function testGetLastIndexed() + { + $this->assertEquals("", $this->getDriver()->getLastIndexed()); + } + + /** + * Test getPrimaryAuthorsWithHighlighting for a record. + * + * @return void + */ + public function testGetPrimaryAuthorsWithHighlighting() + { + $primAuthHighlight = ["Vico, Giambattista, 1668-1744."]; + $this->assertEquals($primAuthHighlight, $this->getDriver()->getPrimaryAuthorsWithHighlighting()); + } + + /** + * Test getDateSpan for a record. + * + * @return void + */ + public function testGetDateSpan() + { + $this->assertEquals([], $this->getDriver()->getDateSpan()); + } + + /** + * Test getCorporateAuthorsRoles for a record. + * + * @return void + */ + public function testGetCorporateAuthorsRoles() + { + $this->assertEquals([], $this->getDriver()->getCorporateAuthorsRoles()); + } + + /** + * Test getCorporateAuthors for a record. + * + * @return void + */ + public function testGetCorporateAuthors() + { + $this->assertEquals([], $this->getDriver()->getCorporateAuthors()); + } + + /** + * Test getCleanDOI for a record. + * + * @return void + */ + public function testGetCleanDOI() + { + $cleanDOI = false; + $this->assertEquals($cleanDOI, $this->getDriver()->getCleanDOI()); + } + + /** + * Test getCallNumber for a record. + * + * @return void + */ + public function testGetCallNumber() + { + $this->assertEquals("", $this->getDriver()->getCallNumber()); + } + + /** + * Test getBreadcrumb for a record. + * + * @return void + */ + public function testGetBreadcrumb() + { + $breadcrumb = "La congiura dei Principi Napoletani 1701 :"; + $this->assertEquals($breadcrumb, $this->getDriver()->getBreadcrumb()); + } + + /** + * Get a record driver with fake data. + * + * @param array $overrides Fixture fields to override. + * + * @return SolrDefault + */ + protected function getDriver($overrides = []) + { + $fixture = json_decode( + file_get_contents( + realpath( + VUFIND_PHPUNIT_MODULE_PATH . '/fixtures/misc/testbug2.json' + ) + ), + true + ); + + $record = new DefaultRecord(); + $record->setRawData($overrides + $fixture['response']['docs'][0]); + return $record; + } +} diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/EDSTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/EDSTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8f42bd0c9a0c6638eccb79118f3ec535bfbc058b --- /dev/null +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/EDSTest.php @@ -0,0 +1,306 @@ +<?php +/** + * EDS Record Driver Test Class + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category VuFind + * @package Tests + * @author Demian Katz <demian.katz@villanova.edu> + * @author Sravanthi Adusumilli <vufind-tech@lists.sourceforge.net> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + */ +namespace VuFindTest\RecordDriver; + +use VuFind\RecordDriver\EDS; + +/** + * EDS Record Driver Test Class + * + * @category VuFind + * @package Tests + * @author Demian Katz <demian.katz@villanova.edu> + * @author Sravanthi Adusumilli <vufind-tech@lists.sourceforge.net> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + */ +class EDSTest extends \VuFindTest\Unit\TestCase +{ + /** + * Test exportDisabled for a record. + * + * @return void + */ + public function testExportDisabled() + { + $this->assertEquals(true, $this->getDriver()->exportDisabled('endnote')); + } + + /** + * Test getUniqueID for a record. + * + * @return void + */ + public function testGetUniqueID() + { + $overrides = [ + 'Header' => ['DbId' => 'TDB123', 'An' => 'TAn456'] + ]; + $driver = $this->getDriver($overrides); + $this->assertEquals('TDB123,TAn456', $driver->getUniqueID()); + } + + /** + * Test getShortTitle for a record. + * + * @return void + */ + public function testGetShortTitle() + { + $this->assertEquals('', $this->getDriver()->getShortTitle()); + } + + /** + * Test getItemsAbstract for a record. + * + * @return void + */ + public function testGetItemsAbstract() + { + $this->assertEquals('', $this->getDriver()->getItemsAbstract()); + } + + /** + * Test getAccessLevel for a record. + * + * @return void + */ + public function testGetAccessLevel() + { + $this->assertEquals('', $this->getDriver()->getAccessLevel()); + } + + /** + * Test getItemsAuthors for a record. + * + * @return void + */ + public function testGetItemsAuthors() + { + $this->assertEquals('', $this->getDriver()->getItemsAuthors()); + } + + /** + * Test getCustomLinks for a record. + * + * @return void + */ + public function testGetCustomLinks() + { + $this->assertEquals([], $this->getDriver()->getCustomLinks()); + } + + /** + * Test getFTCustomLinks for a record. + * + * @return void + */ + public function testGetFTCustomLinks() + { + $this->assertEquals([], $this->getDriver()->getFTCustomLinks()); + } + + /** + * Test getDbLabel for a record. + * + * @return void + */ + public function testGetDbLabel() + { + $this->assertEquals('', $this->getDriver()->getDbLabel()); + } + + /** + * Test getHTMLFullText for a record. + * + * @return void + */ + public function testGetHTMLFullText() + { + $this->assertEquals('', $this->getDriver()->getHTMLFullText()); + } + + /** + * Test hasHTMLFullTextAvailable for a record. + * + * @return void + */ + public function testHasHTMLFullTextAvailable() + { + $this->assertEquals(false, $this->getDriver()->hasHTMLFullTextAvailable()); + } + + /** + * Test getItems for a record. + * + * @return void + */ + public function testGetItems() + { + $this->assertEquals([], $this->getDriver()->getItems()); + } + + /** + * Test getPLink for a record. + * + * @return void + */ + public function testGetPLink() + { + $this->assertEquals('', $this->getDriver()->getPLink()); + } + + /** + * Test getPubType for a record. + * + * @return void + */ + public function testGetPubType() + { + $this->assertEquals('', $this->getDriver()->getPubType()); + } + + /** + * Test getPubTypeId for a record. + * + * @return void + */ + public function testGetPubTypeId() + { + $this->assertEquals('', $this->getDriver()->getPubTypeId()); + } + + /** + * Test hasPdfAvailable for a record. + * + * @return void + */ + public function testHasPdfAvailable() + { + $this->assertEquals(false, $this->getDriver()->hasPdfAvailable()); + } + + /** + * Test getPdfLink for a record. + * + * @return void + */ + public function testGetPdfLink() + { + $this->assertEquals(false, $this->getDriver()->getPdfLink()); + } + + /** + * Test getItemsSubjects for a record. + * + * @return void + */ + public function testGetItemsSubjects() + { + $this->assertEquals('', $this->getDriver()->getItemsSubjects()); + } + + /** + * Test getThumbnail for a record. + * + * @return void + */ + public function testGetThumbnail() + { + $this->assertEquals(false, $this->getDriver()->getThumbnail()); + } + + /** + * Test getItemsTitle for a record. + * + * @return void + */ + public function testGetItemsTitle() + { + $this->assertEquals('', $this->getDriver()->getItemsTitle()); + } + + /** + * Test getTitle for a record. + * + * @return void + */ + public function testGetTitle() + { + $this->assertEquals('', $this->getDriver()->getTitle()); + } + + /** + * Test getPrimaryAuthors for a record. + * + * @return void + */ + public function testGetPrimaryAuthors() + { + $this->assertEquals([], $this->getDriver()->getPrimaryAuthors()); + } + + /** + * Test getItemsTitleSource for a record. + * + * @return void + */ + public function testGetItemsTitleSource() + { + $this->assertEquals('', $this->getDriver()->getItemsTitleSource()); + } + + /** + * Test linkUrls for a record. + * + * @return void + */ + public function testLinkUrls() + { + $str = "http://fictional.com/sample/url"; + $this->assertEquals("<a href='" . $str . "'>" . $str . "</a>", $this->getDriver()->linkUrls($str)); + } + + /** + * Get a record driver with fake data. + * + * @param array $overrides Fixture fields to override. + * + * @return SolrDefault + */ + protected function getDriver($overrides = []) + { + // Simulate empty response for now: + $fixture = ['response' => ['docs' => [[]]]]; + + $record = new EDS(); + $record->setRawData($overrides + $fixture['response']['docs'][0]); + return $record; + } +} diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/EITTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/EITTest.php new file mode 100644 index 0000000000000000000000000000000000000000..368d27a004800e78925038954aef512bff7b84e6 --- /dev/null +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/EITTest.php @@ -0,0 +1,140 @@ +<?php +/** + * EIT Record Driver Test Class + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category VuFind + * @package Tests + * @author Demian Katz <demian.katz@villanova.edu> + * @author Sravanthi Adusumilli <vufind-tech@lists.sourceforge.net> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + */ +namespace VuFindTest\RecordDriver; + +use VuFind\RecordDriver\EIT; + +/** + * EIT Record Driver Test Class + * + * @category VuFind + * @package Tests + * @author Demian Katz <demian.katz@villanova.edu> + * @author Sravanthi Adusumilli <vufind-tech@lists.sourceforge.net> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + */ +class EITTest extends \VuFindTest\Unit\TestCase +{ + /** + * Test getAllSubjectHeadings for a record. + * + * @return void + */ + public function testGetAllSubjectHeadings() + { + $this->assertEquals([], $this->getDriver()->getAllSubjectHeadings()); + } + + /** + * Test getBreadcrumb for a record. + * + * @return void + */ + public function testGetBreadcrumb() + { + $driver = $this->getDriver(); + $this->assertEquals('', $driver->getBreadcrumb()); + } + + /** + * Test getCleanISSN for a record. + * + * @return void + */ + public function testGetCleanISSN() + { + $this->assertEquals(false, $this->getDriver()->getCleanISSN()); + } + + /** + * Test getFormats for a record. + * + * @return void + */ + public function testGetFormats() + { + $this->assertEquals([], $this->getDriver()->getFormats()); + } + + /** + * Test getPrimaryAuthors for a record. + * + * @return void + */ + public function testGetPrimaryAuthors() + { + $this->assertEquals([], $this->getDriver()->getPrimaryAuthors()); + } + + /** + * Test getPublicationDates for a record. + * + * @return void + */ + public function testGetPublicationDates() + { + $this->assertEquals([], $this->getDriver()->getPublicationDates()); + } + + /** + * Test getPublishers for a record. + * + * @return void + */ + public function testGetPublishers() + { + $overrides = [ + 'header' => [ + 'controlInfo' => [ + 'pubinfo' => ['pub' => ['TestPublisher']] + ] + ] + ]; + $driver = $this->getDriver($overrides); + $this->assertEquals([['TestPublisher']], $driver->getPublishers()); + } + + /** + * Get a record driver with fake data. + * + * @param array $overrides Fixture fields to override. + * + * @return SolrDefault + */ + protected function getDriver($overrides = []) + { + // Simulate empty response for now: + $fixture = ['response' => ['docs' => [[]]]]; + + $record = new EIT(); + $record->setRawData($overrides + $fixture['response']['docs'][0]); + return $record; + } +} diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/SolrDefaultTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/SolrDefaultTest.php index e01a7450d3888b728af5c373104eb44e171d7198..adc1f6ff9ec0fa3c1d216672198f02a8d4676109 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/SolrDefaultTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/SolrDefaultTest.php @@ -54,6 +54,18 @@ class SolrDefaultTest extends \VuFindTest\Unit\TestCase $this->assertEquals('url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rfr_id=info%3Asid%2Fvufind.svn.sourceforge.net%3Agenerator&rft.title=La+congiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F&rft.date=1992&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=La+congiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F&rft.series=Vico%2C+Giambattista%2C+1668-1744.+Works.+1982+%3B&rft.au=Vico%2C+Giambattista%2C+1668-1744.&rft.pub=Centro+di+Studi+Vichiani%2C&rft.edition=Fictional+edition.&rft.isbn=8820737493', $driver->getOpenUrl()); } + /** + * Test a snippet caption. + * + * @return void + */ + public function testGetSnippetCaption() + { + $config = ['Snippet_Captions' => ['foo' => 'bar']]; + $driver = $this->getDriver([], $config); + $this->assertEquals('bar', $driver->getSnippetCaption('foo')); + } + /** * Test an OpenURL for an article. * @@ -117,14 +129,78 @@ XML; $this->assertEquals($expected, $xml); } + /** + * Test getContainerRecordID for a record. + * + * @return void + */ + public function testGetContainerRecordID() + { + $this->assertEquals("", $this->getDriver()->getContainerRecordID()); + } + + /** + * Test getChildRecordCount for a record. + * + * @return void + */ + public function testGetChildRecordCount() + { + $this->assertEquals(0, $this->getDriver()->getChildRecordCount()); + } + + /** + * Test getHighlightedTitle for a record. + * + * @return void + */ + public function testGetHighlightedTitle() + { + $this->assertEquals("", $this->getDriver()->getHighlightedTitle()); + } + + /** + * Test getHighlightedSnippet for a record. + * + * @return void + */ + public function testGetHighlightedSnippet() + { + $this->assertEquals(false, $this->getDriver()->getHighlightedSnippet()); + } + + /** + * Test HighlightDetails for a record. + * + * @return void + */ + public function testHighlightDetails() + { + $details['author'] = 'test'; + $driver = $this->getDriver(); + $driver->setHighlightDetails($details); + $this->assertEquals($details, $driver->getHighlightDetails()); + } + + /** + * Test getRawAuthorHighlights for a record. + * + * @return void + */ + public function testGetRawAuthorHighlights() + { + $this->assertEquals([], $this->getDriver()->getRawAuthorHighlights()); + } + /** * Get a record driver with fake data. * - * @param array $overrides Fixture fields to override. + * @param array $overrides Fixture fields to override. + * @param array $searchConfig Search configuration. * * @return SolrDefault */ - protected function getDriver($overrides = []) + protected function getDriver($overrides = [], $searchConfig = []) { $fixture = json_decode( file_get_contents( @@ -135,7 +211,7 @@ XML; true ); - $record = new SolrDefault(); + $record = new SolrDefault(null, null, new \Zend\Config\Config($searchConfig)); $record->setRawData($overrides + $fixture['response']['docs'][0]); return $record; }