function test_google_scholar_metadata() { $test_data = fopen('php://memory', 'x+'); fwrite($test_data, "@article{aKey,title={A Book},author={Martin Monperrus},publisher={Springer},year=2009,pages={42--4242},number=1}\n" . "@String{x=2008}\n"); fseek($test_data, 0); $db = new BibDataBase(); $db->update_internal("inline", $test_data); $dis = new BibEntryDisplay($db->getEntryByKey('aKey')); $metadata = $dis->metadata_dict(); //print_r($metadata); $this->assertEquals("A Book", $metadata['citation_title']); $this->assertEquals("2009", $metadata['citation_date']); $this->assertEquals("2009", $metadata['citation_year']); $this->assertEquals("42", $metadata['citation_firstpage']); $this->assertEquals("4242", $metadata['citation_lastpage']); $this->assertEquals("1", $metadata['citation_issue']); }
function test_BIBTEXBROWSER_USE_LATEX2HTML() { $bibtex = "@article{aKey,title={\\`a Book},author={Martin Monperrus},publisher={Springer},year=2009,pages={42--4242},number=1}\n"; bibtexbrowser_configure('BIBTEXBROWSER_USE_LATEX2HTML', true); $test_data = fopen('php://memory', 'x+'); fwrite($test_data, $bibtex); fseek($test_data, 0); $db = new BibDataBase(); $db->update_internal("inline", $test_data); $dis = $db->getEntryByKey('aKey'); $this->assertEquals("à Book", $dis->getTitle()); bibtexbrowser_configure('BIBTEXBROWSER_USE_LATEX2HTML', false); $test_data = fopen('php://memory', 'x+'); fwrite($test_data, $bibtex); fseek($test_data, 0); $db = new BibDataBase(); $db->update_internal("inline", $test_data); $dis = $db->getEntryByKey('aKey'); $this->assertEquals("\\`a Book", $dis->getTitle()); }