/** * Test citation generation * * @return void */ public function testCitations() { $citation = new Citation(new \VuFind\Date\Converter()); $citation->setView($this->getPhpRenderer()); $driver = new \VuFindTest\RecordDriver\TestHarness(); foreach ($this->citations as $current) { $driver->setRawData($current['raw']); $cb = $citation->__invoke($driver); // Normalize whitespace: $apa = trim(preg_replace("/\\s+/", " ", $cb->getCitation('APA'))); $this->assertEquals($current['apa'], $apa); // Normalize whitespace: $mla = trim(preg_replace("/\\s+/", " ", $cb->getCitation('MLA'))); $this->assertEquals($current['mla'], $mla); // Normalize whitespace: $chicago = trim(preg_replace("/\\s+/", " ", $cb->getCitation('Chicago'))); $this->assertEquals($current['chicago'], $chicago); } // Test a couple of illegal citation formats: $this->assertEquals('', $cb->getCitation('')); $this->assertEquals('', $cb->getCitation('Citation')); $this->assertEquals('', $cb->getCitation('SupportedCitationFormats')); $this->assertEquals('', $cb->getCitation('badgarbage')); }
/** * Test getUrlList * * @return void */ public function testGetUrlList() { $driver = new \VuFindTest\RecordDriver\TestHarness(); $driver->setRawData(['URLs' => [['route' => 'fake-route', 'prefix' => 'http://proxy?_=', 'desc' => 'a link']]]); $record = $this->getRecord($driver, [], null, 'fake-route', true); $this->assertEquals(['http://proxy?_=http://server-foo/baz'], $record->getUrlList()); }