Skip to content
Snippets Groups Projects
Commit edb61ffd authored by Demian Katz's avatar Demian Katz Committed by Robert Lange
Browse files

Improved EDS record driver (#1661)

- Simplified/standardized existing functionality
- Added more direct data access, enabling citation and export functionality to be enabled.
- Improved/expanded tests (though still not complete)
parent 49386ae5
Branches
Tags
No related merge requests found
This diff is collapsed.
...@@ -42,16 +42,6 @@ use VuFind\RecordDriver\EDS; ...@@ -42,16 +42,6 @@ use VuFind\RecordDriver\EDS;
*/ */
class EDSTest extends \VuFindTest\Unit\TestCase 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. * Test getUniqueID for a record.
* *
...@@ -287,20 +277,90 @@ class EDSTest extends \VuFindTest\Unit\TestCase ...@@ -287,20 +277,90 @@ class EDSTest extends \VuFindTest\Unit\TestCase
$this->assertEquals("<a href='" . $str . "'>" . $str . "</a>", $this->getDriver()->linkUrls($str)); $this->assertEquals("<a href='" . $str . "'>" . $str . "</a>", $this->getDriver()->linkUrls($str));
} }
/**
* Test getISSNs.
*
* @return void
*/
public function testGetISSNs()
{
$driver = $this->getDriverWithIdentifierData();
$this->assertEquals(
['1234-5678', '5678-1234'], $driver->getISSNs()
);
}
/**
* Test getISBNs.
*
* @return void
*/
public function testGetISBNs()
{
$driver = $this->getDriverWithIdentifierData();
$this->assertEquals(
['0123456789X', 'fakeisbnxxx'], $driver->getISBNs()
);
}
/**
* Get a record driver with fake identifier data.
*
* @return EDS
*/
protected function getDriverWithIdentifierData()
{
return $this->getDriver(
[
'RecordInfo' => [
'BibRecord' => [
'BibRelationships' => [
'IsPartOfRelationships' => [
[
'BibEntity' => [
'Identifiers' => [
[
'Type' => 'issn-electronic',
'Value' => '1234-5678'
],
[
'Type' => 'issn-print',
'Value' => '5678-1234'
],
[
'Type' => 'isbn-electronic',
'Value' => '0123456789X'
],
[
'Type' => 'isbn-print',
'Value' => 'fakeisbnxxx'
],
[
'Type' => 'meaningless-noise',
'Value' => 'should never be seen'
],
]
]
]
]
]
]
]
]
);
}
/** /**
* Get a record driver with fake data. * Get a record driver with fake data.
* *
* @param array $overrides Fixture fields to override. * @param array $overrides Raw data for testing
* *
* @return SolrDefault * @return EDS
*/ */
protected function getDriver($overrides = []) protected function getDriver($overrides = [])
{ {
// Simulate empty response for now:
$fixture = ['response' => ['docs' => [[]]]];
$record = new EDS(); $record = new EDS();
$record->setRawData($overrides + $fixture['response']['docs'][0]); $record->setRawData($overrides);
return $record; return $record;
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment