3 if (!defined(
"PHPUnit_MAIN_METHOD")) {
4 define(
"PHPUnit_MAIN_METHOD",
"BibTexTest::main");
7 require_once
"PHPUnit/Framework/TestCase.php";
8 require_once
"PHPUnit/Framework/TestSuite.php";
11 require_once
"PHPUnit/Framework/IncompleteTestError.php";
13 require_once
"Structures/BibTex.php";
14 require_once
"PEAR.php";
30 public static function main() {
31 require_once
"PHPUnit/TextUI/TestRunner.php";
57 $ret = $this->obj->loadFile(
"BibTexTest.php");
59 $this->assertTrue(
$ret);
63 $ret = $this->obj->loadFile((
string)time());
72 $test =
"@foo{bar,john=doe";
74 $shouldbe[
'john'] =
'doe';
75 $shouldbe[
'cite'] =
'bar';
76 $shouldbe[
'entryType'] =
'foo';
77 $this->assertEquals($shouldbe, $this->obj->_parseEntry(
$test));
82 $this->assertTrue($this->obj->_checkEqualSign(
$test,0));
86 $this->assertFalse($this->obj->_checkEqualSign(
$test,2));
90 $this->obj->clearWarnings();
91 $this->obj->_generateWarning(
'type',
'entry');
92 $this->obj->clearWarnings();
93 $this->assertFalse($this->obj->hasWarning());
103 $this->obj->clearWarnings();
104 $test =
'{john@doe}';
105 $this->obj->_validateValue(
$test,
'');
106 $this->assertEquals(
'WARNING_AT_IN_BRACES', $this->obj->warnings[0][
'warning']);
109 $this->obj->clearWarnings();
110 $test =
'"john\"doe"';
111 $this->obj->_validateValue(
$test,
'');
112 $this->assertEquals(
'WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES', $this->obj->warnings[0][
'warning']);
115 $this->obj->clearWarnings();
116 $test =
'{john{doe}';
117 $this->obj->_validateValue(
$test,
'');
118 $this->assertEquals(
'WARNING_UNBALANCED_AMOUNT_OF_BRACES', $this->obj->warnings[0][
'warning']);
121 $this->obj->clearWarnings();
122 $test =
'{john}doe}';
123 $this->obj->_validateValue(
$test,
'');
124 $this->assertEquals(
'WARNING_UNBALANCED_AMOUNT_OF_BRACES', $this->obj->warnings[0][
'warning']);
128 $this->obj->clearWarnings();
129 $this->obj->_generateWarning(
'type',
'entry');
130 $ret = $this->obj->hasWarning();
131 $this->obj->clearWarnings();
132 $this->assertTrue(
$ret);
137 $this->obj->clearWarnings();
138 $this->assertFalse($this->obj->hasWarning());
143 $teststring =
"@Article {art1,author = {John Doe and Jane Doe}}@Article { art2,author = {John Doe and Jane Doe}}";
144 $this->obj->content = $teststring;
146 $this->assertEquals(2, $this->obj->amount());
151 $teststring =
"@Article {art1,author = {John Doe and Jane Doe}}@Article { art2,author = {John Doe and Jane Doe}}";
152 $this->obj->content = $teststring;
155 $shouldbe[
'article'] = 2;
156 $this->assertEquals($shouldbe, $this->obj->getStatistic());
161 $teststring=
"@Article { ppm_jon:1991,
162 author = {John Doe and Jane Doe}
164 $this->obj->content=$teststring;
166 $this->assertEquals(1,$this->obj->amount());
171 $teststring =
"@Article { art1,
172 author = {John Doe and Jane Doe}
175 author = {John Doe and Jane Doe}
177 $this->obj->content = $teststring;
179 $this->assertEquals(2,$this->obj->amount());
184 $teststring =
"@Article { art1,
186 author = {John Doe and Jane Doe}
189 $shouldbe[0][
'entryType'] =
'article';
190 $shouldbe[0][
'cite'] =
'art1';
191 $shouldbe[0][
'title'] =
'Titel1';
192 $shouldbe[0][
'author'][0][
'first'] =
'John';
193 $shouldbe[0][
'author'][0][
'von'] =
'';
194 $shouldbe[0][
'author'][0][
'last'] =
'Doe';
195 $shouldbe[0][
'author'][0][
'jr'] =
'';
196 $shouldbe[0][
'author'][1][
'first'] =
'Jane';
197 $shouldbe[0][
'author'][1][
'von'] =
'';
198 $shouldbe[0][
'author'][1][
'last'] =
'Doe';
199 $shouldbe[0][
'author'][1][
'jr'] =
'';
200 $this->obj->content = $teststring;
202 $this->assertEquals($shouldbe,$this->obj->data);
207 $testarray = array();
208 $testarray[0][
'entryType'] =
'Article';
209 $testarray[0][
'cite'] =
'art1';
210 $testarray[0][
'title'] =
'Titel1';
211 $testarray[0][
'author'][0][
'first'] =
'John';
212 $testarray[0][
'author'][0][
'von'] =
'';
213 $testarray[0][
'author'][0][
'last'] =
'Doe';
214 $testarray[0][
'author'][0][
'jr'] =
'';
215 $testarray[0][
'author'][1][
'first'] =
'Jane';
216 $testarray[0][
'author'][1][
'von'] =
'';
217 $testarray[0][
'author'][1][
'last'] =
'Doe';
218 $testarray[0][
'author'][1][
'jr'] =
'';
219 $shouldbe =
"@article { art1,\n\ttitle = {Titel1},\n\tauthor = {Doe, , John and Doe, , Jane}\n}";
220 $this->obj->data = $testarray;
221 $this->assertEquals(trim($shouldbe),trim($this->obj->bibTex()));
232 $teststring =
"@Article { art1,
234 author = {John Doe and Jane Doe}
236 $this->obj->content = $teststring;
239 $this->assertEquals(2,$this->obj->amount());
245 $teststring =
"@Book{abramowitz+stegun,
246 author = \"Milton Abramowitz and Irene A. Stegun\",
247 title = \"Handbook of Mathematical Functions with
248 Formulas, Graphs, and Mathematical Tables\",
249 publisher = \"Dover\",
251 address = \"New York\",
252 edition = \"ninth Dover printing, tenth GPO printing\",
253 isbn = \"0-486-61272-4\"
256 $shouldbe[0][
'entryType'] =
'book';
257 $shouldbe[0][
'cite'] =
'abramowitz+stegun';
258 $shouldbe[0][
'title'] =
"Handbook of Mathematical Functions with
259 Formulas, Graphs, and Mathematical Tables";
260 $shouldbe[0][
'author'][0][
'first'] =
'Milton';
261 $shouldbe[0][
'author'][0][
'von'] =
'';
262 $shouldbe[0][
'author'][0][
'last'] =
'Abramowitz';
263 $shouldbe[0][
'author'][0][
'jr'] =
'';
264 $shouldbe[0][
'author'][1][
'first'] =
'Irene A.';
265 $shouldbe[0][
'author'][1][
'von'] =
'';
266 $shouldbe[0][
'author'][1][
'last'] =
'Stegun';
267 $shouldbe[0][
'author'][1][
'jr'] =
'';
268 $shouldbe[0][
'publisher'] =
'Dover';
269 $shouldbe[0][
'year'] =
'1964';
270 $shouldbe[0][
'address'] =
'New York';
271 $shouldbe[0][
'edition'] =
'ninth Dover printing, tenth GPO printing';
272 $shouldbe[0][
'isbn'] =
'0-486-61272-4';
273 $this->obj->content = $teststring;
275 $this->assertEquals($shouldbe, $this->obj->data);
280 $teststring =
"@Article { art1,
282 author = {John Doe and Jane Doe}
287 author = {John Doe and Jane Doe}
290 $shouldbe[0][
'entryType'] =
'article';
291 $shouldbe[0][
'cite'] =
'art1';
292 $shouldbe[0][
'title'] =
'Titel1';
293 $shouldbe[0][
'author'][0][
'first'] =
'John';
294 $shouldbe[0][
'author'][0][
'von'] =
'';
295 $shouldbe[0][
'author'][0][
'last'] =
'Doe';
296 $shouldbe[0][
'author'][0][
'jr'] =
'';
297 $shouldbe[0][
'author'][1][
'first'] =
'Jane';
298 $shouldbe[0][
'author'][1][
'von'] =
'';
299 $shouldbe[0][
'author'][1][
'last'] =
'Doe';
300 $shouldbe[0][
'author'][1][
'jr'] =
'';
301 $shouldbe[1][
'entryType'] =
'article';
302 $shouldbe[1][
'cite'] =
'art2';
303 $shouldbe[1][
'title'] =
'Titel2';
304 $shouldbe[1][
'author'][0][
'first'] =
'John';
305 $shouldbe[1][
'author'][0][
'von'] =
'';
306 $shouldbe[1][
'author'][0][
'last'] =
'Doe';
307 $shouldbe[1][
'author'][0][
'jr'] =
'';
308 $shouldbe[1][
'author'][1][
'first'] =
'Jane';
309 $shouldbe[1][
'author'][1][
'von'] =
'';
310 $shouldbe[1][
'author'][1][
'last'] =
'Doe';
311 $shouldbe[1][
'author'][1][
'jr'] =
'';
312 $this->obj->content = $teststring;
314 $this->assertTrue($this->obj->data == $shouldbe);
336 $teststring =
"@Article { art1,
338 author = {John {Doe and {Jane Doe}
340 $this->obj->content = $teststring;
345 $teststring =
"@Article { art1,
347 author = {John Doe and @Jane Doe}
349 $this->obj->content = $teststring;
351 $this->assertTrue(
'WARNING_AT_IN_BRACES'==$this->obj->warnings[0][
'warning']);
354 $teststring =
"@Article { art1,
356 author = \"John Doe and \\\"Jane Doe\"
358 $this->obj->content = $teststring;
360 $this->assertTrue(
'WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES'==$this->obj->warnings[0][
'warning']);
374 $teststring =
"@Article { art1,
376 author = {John Doe and Jane Doe}
380 author = {John Doe and Jane Doe}
384 author = {John Doe and Jane Doe}
388 author = {John Doe and Jane Doe}
392 author = {John Doe and Jane Doe}
394 $this->obj->content = $teststring;
396 $this->assertTrue(
'WARNING_MULTIPLE_ENTRIES'==$this->obj->warnings[0][
'warning']);
410 $shouldbe[0][
'first'] =
'AA';
411 $shouldbe[0][
'von'] =
'';
412 $shouldbe[0][
'last'] =
'BB';
413 $shouldbe[0][
'jr'] =
'';
414 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
420 $shouldbe[0][
'first'] =
'';
421 $shouldbe[0][
'von'] =
'';
422 $shouldbe[0][
'last'] =
'AA';
423 $shouldbe[0][
'jr'] =
'';
424 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
430 $shouldbe[0][
'first'] =
'AA';
431 $shouldbe[0][
'von'] =
'';
432 $shouldbe[0][
'last'] =
'bb';
433 $shouldbe[0][
'jr'] =
'';
434 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
440 $shouldbe[0][
'first'] =
'';
441 $shouldbe[0][
'von'] =
'';
442 $shouldbe[0][
'last'] =
'aa';
443 $shouldbe[0][
'jr'] =
'';
444 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
450 $shouldbe[0][
'first'] =
'AA';
451 $shouldbe[0][
'von'] =
'bb';
452 $shouldbe[0][
'last'] =
'CC';
453 $shouldbe[0][
'jr'] =
'';
454 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
457 $test =
"AA bb CC dd EE";
459 $shouldbe[0][
'first'] =
'AA';
460 $shouldbe[0][
'von'] =
'bb CC dd';
461 $shouldbe[0][
'last'] =
'EE';
462 $shouldbe[0][
'jr'] =
'';
463 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
466 $test =
"AA 1B cc dd";
468 $shouldbe[0][
'first'] =
'AA 1B';
469 $shouldbe[0][
'von'] =
'cc';
470 $shouldbe[0][
'last'] =
'dd';
471 $shouldbe[0][
'jr'] =
'';
472 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
475 $test =
"AA 1b cc dd";
477 $shouldbe[0][
'first'] =
'AA';
478 $shouldbe[0][
'von'] =
'1b cc';
479 $shouldbe[0][
'last'] =
'dd';
480 $shouldbe[0][
'jr'] =
'';
481 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
484 $test =
"AA {b}B cc dd";
486 $shouldbe[0][
'first'] =
'AA {b}B';
487 $shouldbe[0][
'von'] =
'cc';
488 $shouldbe[0][
'last'] =
'dd';
489 $shouldbe[0][
'jr'] =
'';
490 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
493 $test =
"AA {b}b cc dd";
495 $shouldbe[0][
'first'] =
'AA';
496 $shouldbe[0][
'von'] =
'{b}b cc';
497 $shouldbe[0][
'last'] =
'dd';
498 $shouldbe[0][
'jr'] =
'';
499 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
502 $test =
"AA {B}B cc dd";
504 $shouldbe[0][
'first'] =
'AA {B}B';
505 $shouldbe[0][
'von'] =
'cc';
506 $shouldbe[0][
'last'] =
'dd';
507 $shouldbe[0][
'jr'] =
'';
508 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
511 $test =
"AA {B}b cc dd";
513 $shouldbe[0][
'first'] =
'AA';
514 $shouldbe[0][
'von'] =
'{B}b cc';
515 $shouldbe[0][
'last'] =
'dd';
516 $shouldbe[0][
'jr'] =
'';
517 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
520 $test =
"AA \BB{b} cc dd";
522 $shouldbe[0][
'first'] =
'AA \BB{b}';
523 $shouldbe[0][
'von'] =
'cc';
524 $shouldbe[0][
'last'] =
'dd';
525 $shouldbe[0][
'jr'] =
'';
526 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
529 $test =
"AA \bb{b} cc dd";
531 $shouldbe[0][
'first'] =
'AA';
532 $shouldbe[0][
'von'] =
'\bb{b} cc';
533 $shouldbe[0][
'last'] =
'dd';
534 $shouldbe[0][
'jr'] =
'';
535 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
538 $test =
"AA {bb} cc DD";
540 $shouldbe[0][
'first'] =
'AA {bb}';
541 $shouldbe[0][
'von'] =
'cc';
542 $shouldbe[0][
'last'] =
'DD';
543 $shouldbe[0][
'jr'] =
'';
544 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
547 $test =
"AA bb {cc} DD";
549 $shouldbe[0][
'first'] =
'AA';
550 $shouldbe[0][
'von'] =
'bb';
551 $shouldbe[0][
'last'] =
'{cc} DD';
552 $shouldbe[0][
'jr'] =
'';
553 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
556 $test =
"AA {bb} CC";
558 $shouldbe[0][
'first'] =
'AA {bb}';
559 $shouldbe[0][
'von'] =
'';
560 $shouldbe[0][
'last'] =
'CC';
561 $shouldbe[0][
'jr'] =
'';
562 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
567 $shouldbe[0][
'first'] =
'AA';
568 $shouldbe[0][
'von'] =
'bb';
569 $shouldbe[0][
'last'] =
'CC';
570 $shouldbe[0][
'jr'] =
'';
571 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
576 $shouldbe[0][
'first'] =
'aa';
577 $shouldbe[0][
'von'] =
'bb';
578 $shouldbe[0][
'last'] =
'CC';
579 $shouldbe[0][
'jr'] =
'';
580 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
583 $test =
"bb CC dd EE, AA";
585 $shouldbe[0][
'first'] =
'AA';
586 $shouldbe[0][
'von'] =
'bb CC dd';
587 $shouldbe[0][
'last'] =
'EE';
588 $shouldbe[0][
'jr'] =
'';
589 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
594 $shouldbe[0][
'first'] =
'AA';
595 $shouldbe[0][
'von'] =
'';
596 $shouldbe[0][
'last'] =
'bb';
597 $shouldbe[0][
'jr'] =
'';
598 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
603 $shouldbe[0][
'first'] =
'';
604 $shouldbe[0][
'von'] =
'';
605 $shouldbe[0][
'last'] =
'BB';
606 $shouldbe[0][
'jr'] =
'';
607 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
610 $test =
"bb CC,XX, AA";
612 $shouldbe[0][
'first'] =
'AA';
613 $shouldbe[0][
'von'] =
'bb';
614 $shouldbe[0][
'last'] =
'CC';
615 $shouldbe[0][
'jr'] =
'XX';
616 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
619 $test =
"bb CC,xx, AA";
621 $shouldbe[0][
'first'] =
'AA';
622 $shouldbe[0][
'von'] =
'bb';
623 $shouldbe[0][
'last'] =
'CC';
624 $shouldbe[0][
'jr'] =
'xx';
625 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
630 $shouldbe[0][
'first'] =
'AA';
631 $shouldbe[0][
'von'] =
'';
632 $shouldbe[0][
'last'] =
'BB';
633 $shouldbe[0][
'jr'] =
'';
634 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
639 $this->assertEquals(1, $this->obj->_determineCase(
$test));
643 $this->assertEquals(0, $this->obj->_determineCase(
$test));
647 $this->assertEquals(-1, $this->obj->_determineCase(
$test));
651 $this->assertEquals(1, $this->obj->_determineCase(
$test));
655 $this->assertEquals(0, $this->obj->_determineCase(
$test));
659 $this->assertEquals(1, $this->obj->_determineCase(
$test));
663 $this->assertEquals(0, $this->obj->_determineCase(
$test));
667 $this->assertEquals(1, $this->obj->_determineCase(
$test));
671 $this->assertEquals(0, $this->obj->_determineCase(
$test));
684 $this->assertTrue($this->obj->_checkAllowedEntryType(
$test));
688 $this->assertFalse($this->obj->_checkAllowedEntryType(
$test));
692 $this->obj->clearWarnings();
693 $test =
"@Foo { art1,
695 author = {John Doe and Jane Doe}
697 $this->obj->content =
$test;
698 $this->obj->setOption(
'validate',
true);
700 $this->assertEquals(
'WARNING_NOT_ALLOWED_ENTRY_TYPE', $this->obj->warnings[0][
'warning']);
704 $this->obj->clearWarnings();
731 $this->obj->content =
$test;
732 $this->obj->setOption(
'validate',
true);
734 $this->assertEquals($this->obj->amount(), 4);
738 $this->obj->clearWarnings();
746 $this->obj->content =
$test;
747 $this->obj->setOption(
'validate',
true);
749 $this->assertEquals($this->obj->amount(), 1);
753 $this->obj->clearWarnings();
780 $this->obj->content =
$test;
781 $this->obj->setOption(
'validate',
true);
783 $this->assertEquals($this->obj->warnings[0][
'warning'],
'WARNING_MISSING_END_BRACE');
787 $this->obj->clearWarnings();
792 author = {author1 and
797 $shouldbe = array(array(
'first'=>
'',
'von'=>
'',
'last'=>
'author1',
'jr'=>
''), array(
'first'=>
'',
'von'=>
'',
'last'=>
'author2',
'jr'=>
''));
798 $this->obj->content =
$test;
799 $this->obj->setOption(
'unwrap',
false);
801 $this->assertEquals($shouldbe, $this->obj->data[0][
'author']);
805 $this->obj->clearWarnings();
809 title = {Do {S}omething},
814 $shouldbe =
'Do {S}omething';
815 $this->obj->content =
$test;
816 $this->obj->setOption(
'removeCurlyBraces',
false);
819 $this->assertEquals($shouldbe, $this->obj->data[0][
'title']);
823 $this->obj->clearWarnings();
827 title = {Do {S}omething},
832 $shouldbe =
'Do Something';
833 $this->obj->content =
$test;
834 $this->obj->setOption(
'removeCurlyBraces',
true);
837 $this->assertEquals($shouldbe, $this->obj->data[0][
'title']);
841 $this->obj->clearWarnings();
845 title = {Do {S}o{me\}th}ing},
850 $shouldbe =
'Do Some\}thing';
851 $this->obj->content =
$test;
852 $this->obj->setOption(
'removeCurlyBraces',
true);
854 $this->assertEquals($shouldbe, $this->obj->data[0][
'title']);
858 $this->obj->clearWarnings();
862 title = {Do Something},
867 $shouldbe =
'Do Something';
868 $this->obj->content =
$test;
869 $this->obj->setOption(
'removeCurlyBraces',
true);
871 $this->assertEquals($shouldbe, $this->obj->data[0][
'title']);
884 author title journal year
887 $this->obj->content =
$test;
889 $oldrtfstring = $this->obj->rtfstring;
890 $this->obj->rtfstring =
'AUTHORS TITLE JOURNAL YEAR';
891 $oldauthorstring = $this->obj->authorstring;
892 $this->obj->authorstring =
'LAST';
895 $rtf = $this->obj->rtf();
897 $this->obj->rtfstring = $oldrtfstring;
898 $this->obj->authorstring = $oldauthorstring;
900 $this->assertEquals($shouldbe, $rtf);
913 author title journal year
916 $this->obj->content =
$test;
918 $oldhtmlstring = $this->obj->htmlstring;
919 $this->obj->htmlstring =
'AUTHORS TITLE JOURNAL YEAR';
920 $oldauthorstring = $this->obj->authorstring;
921 $this->obj->authorstring =
'LAST';
924 $html = $this->obj->html();
926 $this->obj->htmlstring = $oldhtmlstring;
927 $this->obj->authorstring = $oldauthorstring;
929 $this->assertEquals($shouldbe, $html);
935 author = {von Last, Jr ,First}
938 $shouldbe =
'von Last Jr First';
939 $this->obj->content =
$test;
941 $oldhtmlstring = $this->obj->htmlstring;
942 $this->obj->htmlstring =
'AUTHORS';
943 $oldauthorstring = $this->obj->authorstring;
944 $this->obj->authorstring =
'VON LAST JR FIRST';
947 $html = $this->obj->html();
949 $html = trim(strip_tags($html));
951 $this->obj->htmlstring = $oldhtmlstring;
952 $this->obj->authorstring = $oldauthorstring;
954 $this->assertEquals($shouldbe, $html);
960 $shouldbe[0][
'first'] =
'John';
961 $shouldbe[0][
'von'] =
'';
962 $shouldbe[0][
'last'] =
'Doe';
963 $shouldbe[0][
'jr'] =
'';
964 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
970 $shouldbe[0][
'first'] =
'John';
971 $shouldbe[0][
'von'] =
'';
972 $shouldbe[0][
'last'] =
'Doe';
973 $shouldbe[0][
'jr'] =
'';
974 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
978 $this->obj->clearWarnings();
984 $shouldbe =
'John Doe';
985 $this->obj->content =
$test;
986 $this->obj->setOption(
'extractAuthors',
false);
988 $this->assertEquals($shouldbe, $this->obj->data[0][
'author']);
992 $this->obj->clearWarnings();
999 $shouldbe[0][
'first'] =
'John';
1000 $shouldbe[0][
'von'] =
'';
1001 $shouldbe[0][
'last'] =
'Doe';
1002 $shouldbe[0][
'jr'] =
'';
1003 $this->obj->content =
$test;
1004 $this->obj->setOption(
'extractAuthors',
true);
1005 $this->obj->parse();
1006 $this->assertEquals($shouldbe, $this->obj->data[0][
'author']);
1010 $this->obj->clearWarnings();
1011 $test =
"@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1012 $this->obj->content =
$test;
1013 $this->obj->setOption(
'extractAuthors',
false);
1014 $this->obj->parse();
1015 $this->assertEquals(
$test, $this->obj->bibTex());
1019 $this->obj->clearWarnings();
1020 $test =
"@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1022 John Doe, "{\b }", {\i },
1025 $this->obj->content =
$test;
1026 $this->obj->setOption(
'extractAuthors',
false);
1027 $this->obj->parse();
1028 $this->assertEquals($shouldbe, $this->obj->rtf());
1032 $this->obj->clearWarnings();
1033 $test =
"@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1035 John Doe, "<strong></strong>", <em></em>, <br />
1038 $this->obj->content =
$test;
1039 $this->obj->setOption(
'extractAuthors',
false);
1040 $this->obj->parse();
1041 $this->assertEquals($shouldbe, $this->obj->html());
1046 if (PHPUnit_MAIN_METHOD ==
"BibTexTest::main") {