diff --git a/bibtexbrowser-test.php b/bibtexbrowser-test.php index 1ce1744..6973ce0 100755 --- a/bibtexbrowser-test.php +++ b/bibtexbrowser-test.php @@ -284,6 +284,19 @@ class BTBTest extends PHPUnit_Framework_TestCase { $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())); + } } // end class ?> \ No newline at end of file diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 25b6df9..a371f17 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -1492,7 +1492,7 @@ class BibEntry { /** returns the array of keywords */ function getKeywords() { - return preg_split('/[,;\\/]/', $bib->getField("keywords")); + return preg_split('/[,;\\/]/', $this->getField("keywords")); } /** Returns the value of the given field? */