function test_config_value() { // default value $this->assertFalse(config_value('BIBTEXBROWSER_NO_DEFAULT')); // setting to true bibtexbrowser_configure('BIBTEXBROWSER_NO_DEFAULT', true); $this->assertTrue(config_value('BIBTEXBROWSER_NO_DEFAULT')); ob_start(); default_message(); $this->assertEquals('', ob_get_flush()); // setting to false bibtexbrowser_configure('BIBTEXBROWSER_NO_DEFAULT', false); $this->assertFalse(config_value('BIBTEXBROWSER_NO_DEFAULT')); ob_start(); default_message(); $this->assertContains('Congratulations', ob_get_flush()); }
function test_PagedDisplay() { $PAGE_SIZE = 3; bibtexbrowser_configure('BIBTEXBROWSER_DEFAULT_DISPLAY', 'PagedDisplay'); bibtexbrowser_configure('PAGE_SIZE', $PAGE_SIZE); $_GET['bib'] = 'bibacid-utf8.bib'; $_GET['all'] = 1; $d = new Dispatcher(); ob_start(); $d->main(); $content = "<div>" . ob_get_flush() . "</div>"; $xml = new SimpleXMLElement($content); $result = $xml->xpath('//td[@class=\'bibref\']'); $this->assertEquals($PAGE_SIZE, count($result)); }
function test_getKeywords() { $bibtex = "@article{aKey,title={\\`a Book},keywords={foo,bar},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(2, count($dis->getKeywords())); }