/** * Test CrossRef lookup with DOI * @covers WorldcatNlm30CitationSchemaFilter */ public function testExecuteWithDoi() { // Test book lookup $testWithApiKey = array('testInput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula'), 'surname' => 'Fernandes Lopes')), 'source' => 'A ética platônica: modelo de ética da boa vida'), 'testOutput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula', 'Fernandes'), 'surname' => 'Lopes')), 'source' => 'A ética platônica : modelo de ética da boa vida', 'isbn' => '851503154X', 'publisher-loc' => 'São Paulo', 'publisher-name' => 'Ed. Loyola', 'date' => '2005')); // Build the test citations array $citationFilterTests = array($testWithApiKey); // Execute the tests with API key $filter = new WorldcatNlm30CitationSchemaFilter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)')); $filter->setData('apiKey', self::WORLDCAT_TEST_APIKEY); $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter); // Try again without API key $testWithoutApiKey = array('testInput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula'), 'surname' => 'Fernandes Lopes')), 'source' => 'A ética platônica: modelo de ética da boa vida'), 'testOutput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula', 'Fernandes'), 'surname' => 'Lopes')), 'source' => 'A ética platônica : modelo de ética da boa vida', 'isbn' => '9788515031542', 'date' => '2005', 'publisher-name' => 'Ed. Loyola', 'publisher-loc' => 'São Paulo')); $citationFilterTests = array($testWithoutApiKey); $filter = new WorldcatNlm30CitationSchemaFilter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)')); $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter); }
/** * Test CrossRef lookup with DOI * @covers WorldcatNlm30CitationSchemaFilter */ public function testExecuteWithDoi() { // Test book lookup $testWithApiKey = array('testInput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula'), 'surname' => 'Fernandes Lopes')), 'source' => 'A ética platônica: modelo de ética da boa vida'), 'testOutput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula', 'Fernandes'), 'surname' => 'Lopes')), 'source' => 'A ética platônica : modelo de ética da boa vida', 'isbn' => '851503154X', 'publisher-loc' => 'São Paulo', 'publisher-name' => 'Ed. Loyola', 'date' => '2005', '[@publication-type]' => NLM30_PUBLICATION_TYPE_BOOK)); // Build the test citations array $citationFilterTests = array($testWithApiKey); // Execute the tests with API key self::assertEquals(80, strlen(Config::getVar('debug', 'worldcat_apikey')), 'It seems that the WorldCat API key has not been configured.'); $filter = new WorldcatNlm30CitationSchemaFilter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)')); $filter->setData('apiKey', Config::getVar('debug', 'worldcat_apikey')); $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter); // Try again without API key $testWithoutApiKey = array('testInput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula'), 'surname' => 'Fernandes Lopes')), 'source' => 'A ética platônica: modelo de ética da boa vida'), 'testOutput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula', 'Fernandes'), 'surname' => 'Lopes')), 'source' => 'A ética platônica : modelo de ética da boa vida', 'isbn' => '9788515031542', 'date' => '2005', 'publisher-name' => 'Ed. Loyola', 'publisher-loc' => 'São Paulo', '[@publication-type]' => NLM30_PUBLICATION_TYPE_BOOK)); $citationFilterTests = array($testWithoutApiKey); $filter = new WorldcatNlm30CitationSchemaFilter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)')); $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter); }