Example #1
0
 /**
  * Test a record that used to be known to cause problems because of the way
  * series name was handled (the old "Bug2" test from VuFind 1.x).
  *
  * @return void
  */
 public function testBug2()
 {
     $fixture = json_decode(file_get_contents(realpath(VUFIND_PHPUNIT_MODULE_PATH . '/fixtures/misc/testbug2.json')), true);
     $record = new \VuFind\RecordDriver\SolrMarc();
     $record->setRawData($fixture['response']['docs'][0]);
     $this->assertEquals($record->getPrimaryAuthor(), 'Vico, Giambattista, 1668-1744.');
     $secondary = $record->getSecondaryAuthors();
     $this->assertEquals(count($secondary), 1);
     $this->assertTrue(in_array('Pandolfi, Claudia.', $secondary));
     $series = $record->getSeries();
     $this->assertEquals(count($series), 1);
     $this->assertEquals('Vico, Giambattista, 1668-1744. Works. 1982 ;', $series[0]['name']);
     $this->assertEquals('2, pt. 1.', $series[0]['number']);
 }
Example #2
0
 /**
  * Test a record that used to be known to cause problems because of the way
  * series name was handled (the old "Bug2" test from VuFind 1.x).
  *
  * @return void
  */
 public function testBug2()
 {
     $record = new \VuFind\RecordDriver\SolrMarc();
     $fixture = $this->loadRecordFixture('testbug2.json');
     $record->setRawData($fixture['response']['docs'][0]);
     $this->assertEquals($record->getPrimaryAuthor(), 'Vico, Giambattista, 1668-1744.');
     $secondary = $record->getSecondaryAuthors();
     $this->assertEquals(count($secondary), 1);
     $this->assertTrue(in_array('Pandolfi, Claudia.', $secondary));
     $series = $record->getSeries();
     $this->assertEquals(count($series), 1);
     $this->assertEquals('Vico, Giambattista, 1668-1744. Works. 1982 ;', $series[0]['name']);
     $this->assertEquals('2, pt. 1.', $series[0]['number']);
 }
Example #3
0
 /**
  * Load a fixture file.
  *
  * @param string $file File to load from fixture directory.
  *
  * @return array
  */
 protected function loadRecordFixture($file)
 {
     $json = json_decode(file_get_contents(realpath(VUFIND_PHPUNIT_MODULE_PATH . '/fixtures/misc/' . $file)), true);
     $record = new \VuFind\RecordDriver\SolrMarc();
     $record->setRawData($json['response']['docs'][0]);
     return $record;
 }