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";
31 public static function main() {
32 require_once
"PHPUnit/TextUI/TestRunner.php";
61 $ret = $this->obj->loadFile(
"BibTexTest.php");
63 $this->assertTrue(
$ret);
68 $ret = $this->obj->loadFile((
string)time());
78 $test =
"@foo{bar,john=doe";
80 $shouldbe[
'john'] =
'doe';
81 $shouldbe[
'cite'] =
'bar';
82 $shouldbe[
'entryType'] =
'foo';
83 $this->assertEquals($shouldbe, $this->obj->_parseEntry(
$test));
89 $this->assertTrue($this->obj->_checkEqualSign(
$test, 0));
95 $this->assertFalse($this->obj->_checkEqualSign(
$test, 2));
100 $this->obj->clearWarnings();
101 $this->obj->_generateWarning(
'type',
'entry');
102 $this->obj->clearWarnings();
103 $this->assertFalse($this->obj->hasWarning());
114 $this->obj->clearWarnings();
115 $test =
'{john@doe}';
116 $this->obj->_validateValue(
$test,
'');
117 $this->assertEquals(
'WARNING_AT_IN_BRACES', $this->obj->warnings[0][
'warning']);
122 $this->obj->clearWarnings();
123 $test =
'"john\"doe"';
124 $this->obj->_validateValue(
$test,
'');
125 $this->assertEquals(
'WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES', $this->obj->warnings[0][
'warning']);
130 $this->obj->clearWarnings();
131 $test =
'{john{doe}';
132 $this->obj->_validateValue(
$test,
'');
133 $this->assertEquals(
'WARNING_UNBALANCED_AMOUNT_OF_BRACES', $this->obj->warnings[0][
'warning']);
138 $this->obj->clearWarnings();
139 $test =
'{john}doe}';
140 $this->obj->_validateValue(
$test,
'');
141 $this->assertEquals(
'WARNING_UNBALANCED_AMOUNT_OF_BRACES', $this->obj->warnings[0][
'warning']);
146 $this->obj->clearWarnings();
147 $this->obj->_generateWarning(
'type',
'entry');
148 $ret = $this->obj->hasWarning();
149 $this->obj->clearWarnings();
150 $this->assertTrue(
$ret);
155 $this->obj->clearWarnings();
156 $this->assertFalse($this->obj->hasWarning());
161 $teststring =
"@Article {art1,author = {John Doe and Jane Doe}}@Article { art2,author = {John Doe and Jane Doe}}";
162 $this->obj->content = $teststring;
164 $this->assertEquals(2, $this->obj->amount());
169 $teststring =
"@Article {art1,author = {John Doe and Jane Doe}}@Article { art2,author = {John Doe and Jane Doe}}";
170 $this->obj->content = $teststring;
173 $shouldbe[
'article'] = 2;
174 $this->assertEquals($shouldbe, $this->obj->getStatistic());
179 $teststring =
"@Article { ppm_jon:1991,
180 author = {John Doe and Jane Doe}
182 $this->obj->content = $teststring;
184 $this->assertEquals(1, $this->obj->amount());
189 $teststring =
"@Article { art1,
190 author = {John Doe and Jane Doe}
193 author = {John Doe and Jane Doe}
195 $this->obj->content = $teststring;
197 $this->assertEquals(2, $this->obj->amount());
202 $teststring =
"@Article { art1,
204 author = {John Doe and Jane Doe}
207 $shouldbe[0][
'entryType'] =
'article';
208 $shouldbe[0][
'cite'] =
'art1';
209 $shouldbe[0][
'title'] =
'Titel1';
210 $shouldbe[0][
'author'][0][
'first'] =
'John';
211 $shouldbe[0][
'author'][0][
'von'] =
'';
212 $shouldbe[0][
'author'][0][
'last'] =
'Doe';
213 $shouldbe[0][
'author'][0][
'jr'] =
'';
214 $shouldbe[0][
'author'][1][
'first'] =
'Jane';
215 $shouldbe[0][
'author'][1][
'von'] =
'';
216 $shouldbe[0][
'author'][1][
'last'] =
'Doe';
217 $shouldbe[0][
'author'][1][
'jr'] =
'';
218 $this->obj->content = $teststring;
220 $this->assertEquals($shouldbe, $this->obj->data);
225 $testarray = array();
226 $testarray[0][
'entryType'] =
'Article';
227 $testarray[0][
'cite'] =
'art1';
228 $testarray[0][
'title'] =
'Titel1';
229 $testarray[0][
'author'][0][
'first'] =
'John';
230 $testarray[0][
'author'][0][
'von'] =
'';
231 $testarray[0][
'author'][0][
'last'] =
'Doe';
232 $testarray[0][
'author'][0][
'jr'] =
'';
233 $testarray[0][
'author'][1][
'first'] =
'Jane';
234 $testarray[0][
'author'][1][
'von'] =
'';
235 $testarray[0][
'author'][1][
'last'] =
'Doe';
236 $testarray[0][
'author'][1][
'jr'] =
'';
237 $shouldbe =
"@article { art1,\n\ttitle = {Titel1},\n\tauthor = {Doe, , John and Doe, , Jane}\n}";
238 $this->obj->data = $testarray;
239 $this->assertEquals(trim($shouldbe), trim($this->obj->bibTex()));
250 $teststring =
"@Article { art1,
252 author = {John Doe and Jane Doe}
254 $this->obj->content = $teststring;
257 $this->assertEquals(2, $this->obj->amount());
263 $teststring =
"@Book{abramowitz+stegun,
264 author = \"Milton Abramowitz and Irene A. Stegun\",
265 title = \"Handbook of Mathematical Functions with
266 Formulas, Graphs, and Mathematical Tables\",
267 publisher = \"Dover\",
269 address = \"New York\",
270 edition = \"ninth Dover printing, tenth GPO printing\",
271 isbn = \"0-486-61272-4\"
274 $shouldbe[0][
'entryType'] =
'book';
275 $shouldbe[0][
'cite'] =
'abramowitz+stegun';
276 $shouldbe[0][
'title'] =
"Handbook of Mathematical Functions with
277 Formulas, Graphs, and Mathematical Tables";
278 $shouldbe[0][
'author'][0][
'first'] =
'Milton';
279 $shouldbe[0][
'author'][0][
'von'] =
'';
280 $shouldbe[0][
'author'][0][
'last'] =
'Abramowitz';
281 $shouldbe[0][
'author'][0][
'jr'] =
'';
282 $shouldbe[0][
'author'][1][
'first'] =
'Irene A.';
283 $shouldbe[0][
'author'][1][
'von'] =
'';
284 $shouldbe[0][
'author'][1][
'last'] =
'Stegun';
285 $shouldbe[0][
'author'][1][
'jr'] =
'';
286 $shouldbe[0][
'publisher'] =
'Dover';
287 $shouldbe[0][
'year'] =
'1964';
288 $shouldbe[0][
'address'] =
'New York';
289 $shouldbe[0][
'edition'] =
'ninth Dover printing, tenth GPO printing';
290 $shouldbe[0][
'isbn'] =
'0-486-61272-4';
291 $this->obj->content = $teststring;
293 $this->assertEquals($shouldbe, $this->obj->data);
298 $teststring =
"@Article { art1,
300 author = {John Doe and Jane Doe}
305 author = {John Doe and Jane Doe}
308 $shouldbe[0][
'entryType'] =
'article';
309 $shouldbe[0][
'cite'] =
'art1';
310 $shouldbe[0][
'title'] =
'Titel1';
311 $shouldbe[0][
'author'][0][
'first'] =
'John';
312 $shouldbe[0][
'author'][0][
'von'] =
'';
313 $shouldbe[0][
'author'][0][
'last'] =
'Doe';
314 $shouldbe[0][
'author'][0][
'jr'] =
'';
315 $shouldbe[0][
'author'][1][
'first'] =
'Jane';
316 $shouldbe[0][
'author'][1][
'von'] =
'';
317 $shouldbe[0][
'author'][1][
'last'] =
'Doe';
318 $shouldbe[0][
'author'][1][
'jr'] =
'';
319 $shouldbe[1][
'entryType'] =
'article';
320 $shouldbe[1][
'cite'] =
'art2';
321 $shouldbe[1][
'title'] =
'Titel2';
322 $shouldbe[1][
'author'][0][
'first'] =
'John';
323 $shouldbe[1][
'author'][0][
'von'] =
'';
324 $shouldbe[1][
'author'][0][
'last'] =
'Doe';
325 $shouldbe[1][
'author'][0][
'jr'] =
'';
326 $shouldbe[1][
'author'][1][
'first'] =
'Jane';
327 $shouldbe[1][
'author'][1][
'von'] =
'';
328 $shouldbe[1][
'author'][1][
'last'] =
'Doe';
329 $shouldbe[1][
'author'][1][
'jr'] =
'';
330 $this->obj->content = $teststring;
332 $this->assertTrue($this->obj->data == $shouldbe);
356 $teststring =
"@Article { art1,
358 author = {John {Doe and {Jane Doe}
360 $this->obj->content = $teststring;
366 $teststring =
"@Article { art1,
368 author = {John Doe and @Jane Doe}
370 $this->obj->content = $teststring;
372 $this->assertTrue(
'WARNING_AT_IN_BRACES' == $this->obj->warnings[0][
'warning']);
377 $teststring =
"@Article { art1,
379 author = \"John Doe and \\\"Jane Doe\"
381 $this->obj->content = $teststring;
383 $this->assertTrue(
'WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES' == $this->obj->warnings[0][
'warning']);
399 $teststring =
"@Article { art1,
401 author = {John Doe and Jane Doe}
405 author = {John Doe and Jane Doe}
409 author = {John Doe and Jane Doe}
413 author = {John Doe and Jane Doe}
417 author = {John Doe and Jane Doe}
419 $this->obj->content = $teststring;
421 $this->assertTrue(
'WARNING_MULTIPLE_ENTRIES' == $this->obj->warnings[0][
'warning']);
436 $shouldbe[0][
'first'] =
'AA';
437 $shouldbe[0][
'von'] =
'';
438 $shouldbe[0][
'last'] =
'BB';
439 $shouldbe[0][
'jr'] =
'';
440 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
447 $shouldbe[0][
'first'] =
'';
448 $shouldbe[0][
'von'] =
'';
449 $shouldbe[0][
'last'] =
'AA';
450 $shouldbe[0][
'jr'] =
'';
451 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
458 $shouldbe[0][
'first'] =
'AA';
459 $shouldbe[0][
'von'] =
'';
460 $shouldbe[0][
'last'] =
'bb';
461 $shouldbe[0][
'jr'] =
'';
462 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
469 $shouldbe[0][
'first'] =
'';
470 $shouldbe[0][
'von'] =
'';
471 $shouldbe[0][
'last'] =
'aa';
472 $shouldbe[0][
'jr'] =
'';
473 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
480 $shouldbe[0][
'first'] =
'AA';
481 $shouldbe[0][
'von'] =
'bb';
482 $shouldbe[0][
'last'] =
'CC';
483 $shouldbe[0][
'jr'] =
'';
484 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
489 $test =
"AA bb CC dd EE";
491 $shouldbe[0][
'first'] =
'AA';
492 $shouldbe[0][
'von'] =
'bb CC dd';
493 $shouldbe[0][
'last'] =
'EE';
494 $shouldbe[0][
'jr'] =
'';
495 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
500 $test =
"AA 1B cc dd";
502 $shouldbe[0][
'first'] =
'AA 1B';
503 $shouldbe[0][
'von'] =
'cc';
504 $shouldbe[0][
'last'] =
'dd';
505 $shouldbe[0][
'jr'] =
'';
506 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
511 $test =
"AA 1b cc dd";
513 $shouldbe[0][
'first'] =
'AA';
514 $shouldbe[0][
'von'] =
'1b cc';
515 $shouldbe[0][
'last'] =
'dd';
516 $shouldbe[0][
'jr'] =
'';
517 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
522 $test =
"AA {b}B cc dd";
524 $shouldbe[0][
'first'] =
'AA {b}B';
525 $shouldbe[0][
'von'] =
'cc';
526 $shouldbe[0][
'last'] =
'dd';
527 $shouldbe[0][
'jr'] =
'';
528 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
533 $test =
"AA {b}b cc dd";
535 $shouldbe[0][
'first'] =
'AA';
536 $shouldbe[0][
'von'] =
'{b}b cc';
537 $shouldbe[0][
'last'] =
'dd';
538 $shouldbe[0][
'jr'] =
'';
539 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
544 $test =
"AA {B}B cc dd";
546 $shouldbe[0][
'first'] =
'AA {B}B';
547 $shouldbe[0][
'von'] =
'cc';
548 $shouldbe[0][
'last'] =
'dd';
549 $shouldbe[0][
'jr'] =
'';
550 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
555 $test =
"AA {B}b cc dd";
557 $shouldbe[0][
'first'] =
'AA';
558 $shouldbe[0][
'von'] =
'{B}b cc';
559 $shouldbe[0][
'last'] =
'dd';
560 $shouldbe[0][
'jr'] =
'';
561 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
566 $test =
"AA \BB{b} cc dd";
568 $shouldbe[0][
'first'] =
'AA \BB{b}';
569 $shouldbe[0][
'von'] =
'cc';
570 $shouldbe[0][
'last'] =
'dd';
571 $shouldbe[0][
'jr'] =
'';
572 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
577 $test =
"AA \bb{b} cc dd";
579 $shouldbe[0][
'first'] =
'AA';
580 $shouldbe[0][
'von'] =
'\bb{b} cc';
581 $shouldbe[0][
'last'] =
'dd';
582 $shouldbe[0][
'jr'] =
'';
583 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
588 $test =
"AA {bb} cc DD";
590 $shouldbe[0][
'first'] =
'AA {bb}';
591 $shouldbe[0][
'von'] =
'cc';
592 $shouldbe[0][
'last'] =
'DD';
593 $shouldbe[0][
'jr'] =
'';
594 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
599 $test =
"AA bb {cc} DD";
601 $shouldbe[0][
'first'] =
'AA';
602 $shouldbe[0][
'von'] =
'bb';
603 $shouldbe[0][
'last'] =
'{cc} DD';
604 $shouldbe[0][
'jr'] =
'';
605 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
610 $test =
"AA {bb} CC";
612 $shouldbe[0][
'first'] =
'AA {bb}';
613 $shouldbe[0][
'von'] =
'';
614 $shouldbe[0][
'last'] =
'CC';
615 $shouldbe[0][
'jr'] =
'';
616 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
623 $shouldbe[0][
'first'] =
'AA';
624 $shouldbe[0][
'von'] =
'bb';
625 $shouldbe[0][
'last'] =
'CC';
626 $shouldbe[0][
'jr'] =
'';
627 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
634 $shouldbe[0][
'first'] =
'aa';
635 $shouldbe[0][
'von'] =
'bb';
636 $shouldbe[0][
'last'] =
'CC';
637 $shouldbe[0][
'jr'] =
'';
638 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
643 $test =
"bb CC dd EE, AA";
645 $shouldbe[0][
'first'] =
'AA';
646 $shouldbe[0][
'von'] =
'bb CC dd';
647 $shouldbe[0][
'last'] =
'EE';
648 $shouldbe[0][
'jr'] =
'';
649 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
656 $shouldbe[0][
'first'] =
'AA';
657 $shouldbe[0][
'von'] =
'';
658 $shouldbe[0][
'last'] =
'bb';
659 $shouldbe[0][
'jr'] =
'';
660 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
667 $shouldbe[0][
'first'] =
'';
668 $shouldbe[0][
'von'] =
'';
669 $shouldbe[0][
'last'] =
'BB';
670 $shouldbe[0][
'jr'] =
'';
671 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
676 $test =
"bb CC,XX, AA";
678 $shouldbe[0][
'first'] =
'AA';
679 $shouldbe[0][
'von'] =
'bb';
680 $shouldbe[0][
'last'] =
'CC';
681 $shouldbe[0][
'jr'] =
'XX';
682 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
687 $test =
"bb CC,xx, AA";
689 $shouldbe[0][
'first'] =
'AA';
690 $shouldbe[0][
'von'] =
'bb';
691 $shouldbe[0][
'last'] =
'CC';
692 $shouldbe[0][
'jr'] =
'xx';
693 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
700 $shouldbe[0][
'first'] =
'AA';
701 $shouldbe[0][
'von'] =
'';
702 $shouldbe[0][
'last'] =
'BB';
703 $shouldbe[0][
'jr'] =
'';
704 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
711 $this->assertEquals(1, $this->obj->_determineCase(
$test));
717 $this->assertEquals(0, $this->obj->_determineCase(
$test));
723 $this->assertEquals(- 1, $this->obj->_determineCase(
$test));
729 $this->assertEquals(1, $this->obj->_determineCase(
$test));
735 $this->assertEquals(0, $this->obj->_determineCase(
$test));
741 $this->assertEquals(1, $this->obj->_determineCase(
$test));
747 $this->assertEquals(0, $this->obj->_determineCase(
$test));
753 $this->assertEquals(1, $this->obj->_determineCase(
$test));
759 $this->assertEquals(0, $this->obj->_determineCase(
$test));
777 $this->assertTrue($this->obj->_checkAllowedEntryType(
$test));
783 $this->assertFalse($this->obj->_checkAllowedEntryType(
$test));
788 $this->obj->clearWarnings();
789 $test =
"@Foo { art1,
791 author = {John Doe and Jane Doe}
793 $this->obj->content =
$test;
794 $this->obj->setOption(
'validate',
true);
796 $this->assertEquals(
'WARNING_NOT_ALLOWED_ENTRY_TYPE', $this->obj->warnings[0][
'warning']);
801 $this->obj->clearWarnings();
828 $this->obj->content =
$test;
829 $this->obj->setOption(
'validate',
true);
831 $this->assertEquals($this->obj->amount(), 4);
836 $this->obj->clearWarnings();
844 $this->obj->content =
$test;
845 $this->obj->setOption(
'validate',
true);
847 $this->assertEquals($this->obj->amount(), 1);
852 $this->obj->clearWarnings();
879 $this->obj->content =
$test;
880 $this->obj->setOption(
'validate',
true);
882 $this->assertEquals($this->obj->warnings[0][
'warning'],
'WARNING_MISSING_END_BRACE');
887 $this->obj->clearWarnings();
892 author = {author1 and
898 array(
'first' =>
'',
'von' =>
'',
'last' =>
'author1',
'jr' =>
'' ),
899 array(
'first' =>
'',
'von' =>
'',
'last' =>
'author2',
'jr' =>
'' )
901 $this->obj->content =
$test;
902 $this->obj->setOption(
'unwrap',
false);
904 $this->assertEquals($shouldbe, $this->obj->data[0][
'author']);
909 $this->obj->clearWarnings();
913 title = {Do {S}omething},
918 $shouldbe =
'Do {S}omething';
919 $this->obj->content =
$test;
920 $this->obj->setOption(
'removeCurlyBraces',
false);
923 $this->assertEquals($shouldbe, $this->obj->data[0][
'title']);
928 $this->obj->clearWarnings();
932 title = {Do {S}omething},
937 $shouldbe =
'Do Something';
938 $this->obj->content =
$test;
939 $this->obj->setOption(
'removeCurlyBraces',
true);
942 $this->assertEquals($shouldbe, $this->obj->data[0][
'title']);
947 $this->obj->clearWarnings();
951 title = {Do {S}o{me\}th}ing},
956 $shouldbe =
'Do Some\}thing';
957 $this->obj->content =
$test;
958 $this->obj->setOption(
'removeCurlyBraces',
true);
960 $this->assertEquals($shouldbe, $this->obj->data[0][
'title']);
965 $this->obj->clearWarnings();
969 title = {Do Something},
974 $shouldbe =
'Do Something';
975 $this->obj->content =
$test;
976 $this->obj->setOption(
'removeCurlyBraces',
true);
978 $this->assertEquals($shouldbe, $this->obj->data[0][
'title']);
992 author title journal year
995 $this->obj->content =
$test;
997 $oldrtfstring = $this->obj->rtfstring;
998 $this->obj->rtfstring =
'AUTHORS TITLE JOURNAL YEAR';
999 $oldauthorstring = $this->obj->authorstring;
1000 $this->obj->authorstring =
'LAST';
1001 $this->obj->parse();
1002 $rtf = $this->obj->rtf();
1004 $this->obj->rtfstring = $oldrtfstring;
1005 $this->obj->authorstring = $oldauthorstring;
1006 $this->assertEquals($shouldbe, $rtf);
1015 journal = {journal},
1020 author title journal year
1023 $this->obj->content =
$test;
1025 $oldhtmlstring = $this->obj->htmlstring;
1026 $this->obj->htmlstring =
'AUTHORS TITLE JOURNAL YEAR';
1027 $oldauthorstring = $this->obj->authorstring;
1028 $this->obj->authorstring =
'LAST';
1029 $this->obj->parse();
1030 $html = $this->obj->html();
1032 $this->obj->htmlstring = $oldhtmlstring;
1033 $this->obj->authorstring = $oldauthorstring;
1034 $this->assertEquals($shouldbe, $html);
1041 author = {von Last, Jr ,First}
1044 $shouldbe =
'von Last Jr First';
1045 $this->obj->content =
$test;
1047 $oldhtmlstring = $this->obj->htmlstring;
1048 $this->obj->htmlstring =
'AUTHORS';
1049 $oldauthorstring = $this->obj->authorstring;
1050 $this->obj->authorstring =
'VON LAST JR FIRST';
1051 $this->obj->parse();
1052 $html = $this->obj->html();
1054 $html = trim(strip_tags($html));
1056 $this->obj->htmlstring = $oldhtmlstring;
1057 $this->obj->authorstring = $oldauthorstring;
1058 $this->assertEquals($shouldbe, $html);
1064 $shouldbe = array();
1065 $shouldbe[0][
'first'] =
'John';
1066 $shouldbe[0][
'von'] =
'';
1067 $shouldbe[0][
'last'] =
'Doe';
1068 $shouldbe[0][
'jr'] =
'';
1069 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
1075 $shouldbe = array();
1076 $shouldbe[0][
'first'] =
'John';
1077 $shouldbe[0][
'von'] =
'';
1078 $shouldbe[0][
'last'] =
'Doe';
1079 $shouldbe[0][
'jr'] =
'';
1080 $this->assertEquals($shouldbe, $this->obj->_extractAuthors(
$test));
1085 $this->obj->clearWarnings();
1088 author = {John Doe},
1091 $shouldbe =
'John Doe';
1092 $this->obj->content =
$test;
1093 $this->obj->setOption(
'extractAuthors',
false);
1094 $this->obj->parse();
1095 $this->assertEquals($shouldbe, $this->obj->data[0][
'author']);
1100 $this->obj->clearWarnings();
1103 author = {John Doe},
1106 $shouldbe = array();
1107 $shouldbe[0][
'first'] =
'John';
1108 $shouldbe[0][
'von'] =
'';
1109 $shouldbe[0][
'last'] =
'Doe';
1110 $shouldbe[0][
'jr'] =
'';
1111 $this->obj->content =
$test;
1112 $this->obj->setOption(
'extractAuthors',
true);
1113 $this->obj->parse();
1114 $this->assertEquals($shouldbe, $this->obj->data[0][
'author']);
1119 $this->obj->clearWarnings();
1120 $test =
"@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1121 $this->obj->content =
$test;
1122 $this->obj->setOption(
'extractAuthors',
false);
1123 $this->obj->parse();
1124 $this->assertEquals(
$test, $this->obj->bibTex());
1129 $this->obj->clearWarnings();
1130 $test =
"@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1132 John Doe, "{\b }", {\i },
1135 $this->obj->content =
$test;
1136 $this->obj->setOption(
'extractAuthors',
false);
1137 $this->obj->parse();
1138 $this->assertEquals($shouldbe, $this->obj->rtf());
1143 $this->obj->clearWarnings();
1144 $test =
"@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1146 John Doe, "<strong></strong>", <em></em>, <br />
1149 $this->obj->content =
$test;
1150 $this->obj->setOption(
'extractAuthors',
false);
1151 $this->obj->parse();
1152 $this->assertEquals($shouldbe, $this->obj->html());
1157 if (PHPUnit_MAIN_METHOD ==
"BibTexTest::main") {