Test class for Structures_BibTex.
More...
|
static | main () |
| Runs the test methods of this class. More...
|
|
|
| setUp () |
| Sets up the fixture, for example, open a network connection. More...
|
|
| tearDown () |
| Tears down the fixture, for example, close a network connection. More...
|
|
Test class for Structures_BibTex.
Generated by PHPUnit_Util_Skeleton on 2006-06-06 at 22:13:11.
Definition at line 20 of file BibTexTest.php.
◆ main()
static BibTexTest::main |
( |
| ) |
|
|
static |
◆ setUp()
Sets up the fixture, for example, open a network connection.
This method is called before a test is executed.
protected
Definition at line 42 of file BibTexTest.php.
◆ tearDown()
Tears down the fixture, for example, close a network connection.
This method is called after a test is executed.
protected
Definition at line 52 of file BibTexTest.php.
◆ test_checkEqualSignFalse()
BibTexTest::test_checkEqualSignFalse |
( |
| ) |
|
◆ test_checkEqualSignTrue()
BibTexTest::test_checkEqualSignTrue |
( |
| ) |
|
◆ test_generateWarning()
BibTexTest::test_generateWarning |
( |
| ) |
|
Definition at line 127 of file BibTexTest.php.
References $ret.
128 $this->obj->clearWarnings();
129 $this->obj->_generateWarning(
'type',
'entry');
130 $ret = $this->obj->hasWarning();
131 $this->obj->clearWarnings();
132 $this->assertTrue(
$ret);
◆ test_parseEntry()
BibTexTest::test_parseEntry |
( |
| ) |
|
- Todo:
- Implement test_parseEntry().
Definition at line 70 of file BibTexTest.php.
References $test.
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));
◆ test_validateValueWarningAtInBraces()
BibTexTest::test_validateValueWarningAtInBraces |
( |
| ) |
|
Definition at line 102 of file BibTexTest.php.
References $test.
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']);
◆ test_validateValueWarningEscapedDoubleQuoteInsideDoubleQuotes()
BibTexTest::test_validateValueWarningEscapedDoubleQuoteInsideDoubleQuotes |
( |
| ) |
|
Definition at line 108 of file BibTexTest.php.
References $test.
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']);
◆ test_validateValueWarningUnbalancedAmountOfBracesClosed()
BibTexTest::test_validateValueWarningUnbalancedAmountOfBracesClosed |
( |
| ) |
|
Definition at line 120 of file BibTexTest.php.
References $test.
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']);
◆ test_validateValueWarningUnbalancedAmountOfBracesOpen()
BibTexTest::test_validateValueWarningUnbalancedAmountOfBracesOpen |
( |
| ) |
|
Definition at line 114 of file BibTexTest.php.
References $test.
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']);
◆ testAddEntry()
BibTexTest::testAddEntry |
( |
| ) |
|
Definition at line 224 of file BibTexTest.php.
References $addarray.
232 $teststring =
"@Article { art1, 234 author = {John Doe and Jane Doe} 236 $this->obj->content = $teststring;
239 $this->assertEquals(2,$this->obj->amount());
◆ testAllowedTypeFalse()
BibTexTest::testAllowedTypeFalse |
( |
| ) |
|
◆ testAllowedTypeTrue()
BibTexTest::testAllowedTypeTrue |
( |
| ) |
|
◆ testAllowedTypeWarning()
BibTexTest::testAllowedTypeWarning |
( |
| ) |
|
Definition at line 691 of file BibTexTest.php.
References $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']);
◆ testAmount()
BibTexTest::testAmount |
( |
| ) |
|
Definition at line 141 of file BibTexTest.php.
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());
◆ testAuthorFirstDigitsArecaselessLowercase()
BibTexTest::testAuthorFirstDigitsArecaselessLowercase |
( |
| ) |
|
Definition at line 474 of file BibTexTest.php.
References $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));
◆ testAuthorFirstDigitsArecaselessUppercase()
BibTexTest::testAuthorFirstDigitsArecaselessUppercase |
( |
| ) |
|
Definition at line 465 of file BibTexTest.php.
References $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));
◆ testAuthorFirstGroupingCaselessOne()
BibTexTest::testAuthorFirstGroupingCaselessOne |
( |
| ) |
|
Definition at line 537 of file BibTexTest.php.
References $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));
◆ testAuthorFirstGroupingCaselessThree()
BibTexTest::testAuthorFirstGroupingCaselessThree |
( |
| ) |
|
Definition at line 555 of file BibTexTest.php.
References $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));
◆ testAuthorFirstGroupingCaselessTwo()
BibTexTest::testAuthorFirstGroupingCaselessTwo |
( |
| ) |
|
Definition at line 546 of file BibTexTest.php.
References $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));
◆ testAuthorFirstLastCannotBeEmpty()
BibTexTest::testAuthorFirstLastCannotBeEmpty |
( |
| ) |
|
Definition at line 417 of file BibTexTest.php.
References $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));
◆ testAuthorFirstLastCannotBeEmptyLowerCase()
BibTexTest::testAuthorFirstLastCannotBeEmptyLowerCase |
( |
| ) |
|
Definition at line 437 of file BibTexTest.php.
References $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));
◆ testAuthorFirstNonLettersAreCaselessLowerCase()
BibTexTest::testAuthorFirstNonLettersAreCaselessLowerCase |
( |
| ) |
|
Definition at line 528 of file BibTexTest.php.
References $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));
◆ testAuthorFirstNonLettersAreCaselessUpperCase()
BibTexTest::testAuthorFirstNonLettersAreCaselessUpperCase |
( |
| ) |
|
Definition at line 519 of file BibTexTest.php.
References $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));
◆ testAuthorFirstPseudoLettersAreCaselessLowerInsideLowerOutside()
BibTexTest::testAuthorFirstPseudoLettersAreCaselessLowerInsideLowerOutside |
( |
| ) |
|
Definition at line 492 of file BibTexTest.php.
References $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));
◆ testAuthorFirstPseudoLettersAreCaselessLowerInsideUpperOutside()
BibTexTest::testAuthorFirstPseudoLettersAreCaselessLowerInsideUpperOutside |
( |
| ) |
|
Definition at line 483 of file BibTexTest.php.
References $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));
◆ testAuthorFirstPseudoLettersAreCaselessUpperInsideLowerOutside()
BibTexTest::testAuthorFirstPseudoLettersAreCaselessUpperInsideLowerOutside |
( |
| ) |
|
Definition at line 510 of file BibTexTest.php.
References $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));
◆ testAuthorFirstPseudoLettersAreCaselessUpperInsideUpperOutside()
BibTexTest::testAuthorFirstPseudoLettersAreCaselessUpperInsideUpperOutside |
( |
| ) |
|
Definition at line 501 of file BibTexTest.php.
References $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));
◆ testAuthorFirstSimple()
BibTexTest::testAuthorFirstSimple |
( |
| ) |
|
Definition at line 407 of file BibTexTest.php.
References $test.
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));
◆ testAuthorFirstSimpleLowerCase()
BibTexTest::testAuthorFirstSimpleLowerCase |
( |
| ) |
|
Definition at line 427 of file BibTexTest.php.
References $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));
◆ testAuthorFirstSimpleVon()
BibTexTest::testAuthorFirstSimpleVon |
( |
| ) |
|
Definition at line 447 of file BibTexTest.php.
References $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));
◆ testAuthorFirstSimpleVonInnerUppercase()
BibTexTest::testAuthorFirstSimpleVonInnerUppercase |
( |
| ) |
|
Definition at line 456 of file BibTexTest.php.
References $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));
◆ testAuthorSecondAndThirdFirstCanBeEmptyAfterComma()
BibTexTest::testAuthorSecondAndThirdFirstCanBeEmptyAfterComma |
( |
| ) |
|
Definition at line 600 of file BibTexTest.php.
References $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));
◆ testAuthorSecondAndThirdJrCanBeEmptyBetweenCommas()
BibTexTest::testAuthorSecondAndThirdJrCanBeEmptyBetweenCommas |
( |
| ) |
|
Definition at line 627 of file BibTexTest.php.
References $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));
◆ testAuthorSecondAndThirdLastPartCoannotBeEmpty()
BibTexTest::testAuthorSecondAndThirdLastPartCoannotBeEmpty |
( |
| ) |
|
Definition at line 591 of file BibTexTest.php.
References $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));
◆ testAuthorSecondAndThirdSimpleCaseFirstLowercase()
BibTexTest::testAuthorSecondAndThirdSimpleCaseFirstLowercase |
( |
| ) |
|
Definition at line 573 of file BibTexTest.php.
References $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));
◆ testAuthorSecondAndThirdSimpleCaseFirstUppercase()
BibTexTest::testAuthorSecondAndThirdSimpleCaseFirstUppercase |
( |
| ) |
|
Definition at line 564 of file BibTexTest.php.
References $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));
◆ testAuthorSecondAndThirdSimpleJrLowercase()
BibTexTest::testAuthorSecondAndThirdSimpleJrLowercase |
( |
| ) |
|
Definition at line 618 of file BibTexTest.php.
References $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));
◆ testAuthorSecondAndThirdSimpleJrUppercase()
BibTexTest::testAuthorSecondAndThirdSimpleJrUppercase |
( |
| ) |
|
Definition at line 609 of file BibTexTest.php.
References $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));
◆ testAuthorSecondAndThirdSimpleVon()
BibTexTest::testAuthorSecondAndThirdSimpleVon |
( |
| ) |
|
Definition at line 582 of file BibTexTest.php.
References $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));
◆ testBibTex()
BibTexTest::testBibTex |
( |
| ) |
|
Definition at line 205 of file BibTexTest.php.
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()));
◆ testCaseCaselessSimple()
BibTexTest::testCaseCaselessSimple |
( |
| ) |
|
◆ testCaseErrorEmptyString()
BibTexTest::testCaseErrorEmptyString |
( |
| ) |
|
◆ testCaseErrorNonString()
BibTexTest::testCaseErrorNonString |
( |
| ) |
|
◆ testCaseLowerComplexBrace()
BibTexTest::testCaseLowerComplexBrace |
( |
| ) |
|
◆ testCaseLowerComplexNumber()
BibTexTest::testCaseLowerComplexNumber |
( |
| ) |
|
◆ testCaseLowerComplexWhitespace()
BibTexTest::testCaseLowerComplexWhitespace |
( |
| ) |
|
◆ testCaseLowerSimple()
BibTexTest::testCaseLowerSimple |
( |
| ) |
|
◆ testCaseUpperComplexBrace()
BibTexTest::testCaseUpperComplexBrace |
( |
| ) |
|
◆ testCaseUpperComplexNumber()
BibTexTest::testCaseUpperComplexNumber |
( |
| ) |
|
◆ testCaseUpperComplexWhitespace()
BibTexTest::testCaseUpperComplexWhitespace |
( |
| ) |
|
◆ testCaseUpperSimple()
BibTexTest::testCaseUpperSimple |
( |
| ) |
|
◆ testClearWarnings()
BibTexTest::testClearWarnings |
( |
| ) |
|
Definition at line 89 of file BibTexTest.php.
90 $this->obj->clearWarnings();
91 $this->obj->_generateWarning(
'type',
'entry');
92 $this->obj->clearWarnings();
93 $this->assertFalse($this->obj->hasWarning());
◆ testEntryOverMoreLines()
BibTexTest::testEntryOverMoreLines |
( |
| ) |
|
Definition at line 242 of file BibTexTest.php.
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);
◆ testExtractAuthors()
BibTexTest::testExtractAuthors |
( |
| ) |
|
Definition at line 991 of file BibTexTest.php.
References $test.
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']);
◆ testExtractAuthorTilde()
BibTexTest::testExtractAuthorTilde |
( |
| ) |
|
Definition at line 967 of file BibTexTest.php.
References $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));
◆ testExtractAuthorWhitespace()
BibTexTest::testExtractAuthorWhitespace |
( |
| ) |
|
Definition at line 957 of file BibTexTest.php.
References $test.
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));
◆ testFormatAuthor()
BibTexTest::testFormatAuthor |
( |
| ) |
|
Definition at line 932 of file BibTexTest.php.
References $test.
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);
◆ testGetStatistic()
BibTexTest::testGetStatistic |
( |
| ) |
|
Definition at line 149 of file BibTexTest.php.
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());
◆ testHasWarning()
BibTexTest::testHasWarning |
( |
| ) |
|
Definition at line 135 of file BibTexTest.php.
137 $this->obj->clearWarnings();
138 $this->assertFalse($this->obj->hasWarning());
◆ testHtmlExport()
BibTexTest::testHtmlExport |
( |
| ) |
|
Definition at line 903 of file BibTexTest.php.
References $test.
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);
◆ testLoadFileFileDoesNotExists()
BibTexTest::testLoadFileFileDoesNotExists |
( |
| ) |
|
Definition at line 62 of file BibTexTest.php.
References $ret, and PEAR\isError().
63 $ret = $this->obj->loadFile((
string)time());
isError($data, $code=null)
Tell whether a value is a PEAR error.
◆ testLoadFileFileExists()
BibTexTest::testLoadFileFileExists |
( |
| ) |
|
Definition at line 56 of file BibTexTest.php.
References $ret.
57 $ret = $this->obj->loadFile(
"BibTexTest.php");
59 $this->assertTrue(
$ret);
◆ testMissingLastBraceParsing()
BibTexTest::testMissingLastBraceParsing |
( |
| ) |
|
Definition at line 703 of file BibTexTest.php.
References $test.
704 $this->obj->clearWarnings();
731 $this->obj->content =
$test;
732 $this->obj->setOption(
'validate',
true);
734 $this->assertEquals($this->obj->amount(), 4);
◆ testMissingLastBraceParsing2()
BibTexTest::testMissingLastBraceParsing2 |
( |
| ) |
|
Definition at line 737 of file BibTexTest.php.
References $test.
738 $this->obj->clearWarnings();
746 $this->obj->content =
$test;
747 $this->obj->setOption(
'validate',
true);
749 $this->assertEquals($this->obj->amount(), 1);
◆ testMissingLastBraceWarning()
BibTexTest::testMissingLastBraceWarning |
( |
| ) |
|
Definition at line 752 of file BibTexTest.php.
References $test.
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');
◆ testMultiParse()
BibTexTest::testMultiParse |
( |
| ) |
|
Definition at line 169 of file BibTexTest.php.
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());
◆ testNewlineInAuthorField()
BibTexTest::testNewlineInAuthorField |
( |
| ) |
|
Definition at line 786 of file BibTexTest.php.
References $test.
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']);
◆ testNotExtractAuthors()
BibTexTest::testNotExtractAuthors |
( |
| ) |
|
Definition at line 977 of file BibTexTest.php.
References $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']);
◆ testNotExtractAuthorsBibtexExport()
BibTexTest::testNotExtractAuthorsBibtexExport |
( |
| ) |
|
Definition at line 1009 of file BibTexTest.php.
References $test.
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());
◆ testNotExtractAuthorsHtmlExport()
BibTexTest::testNotExtractAuthorsHtmlExport |
( |
| ) |
|
Definition at line 1031 of file BibTexTest.php.
References $test, and main().
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());
◆ testNotExtractAuthorsRtfExport()
BibTexTest::testNotExtractAuthorsRtfExport |
( |
| ) |
|
Definition at line 1018 of file BibTexTest.php.
References $test.
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());
◆ testNotRemoveCurlyBraces()
BibTexTest::testNotRemoveCurlyBraces |
( |
| ) |
|
Definition at line 804 of file BibTexTest.php.
References $test.
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']);
◆ testParse()
BibTexTest::testParse |
( |
| ) |
|
Definition at line 182 of file BibTexTest.php.
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);
◆ testParsingComment()
BibTexTest::testParsingComment |
( |
| ) |
|
Definition at line 278 of file BibTexTest.php.
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);
◆ testRemoveCurlyBraces()
BibTexTest::testRemoveCurlyBraces |
( |
| ) |
|
Definition at line 822 of file BibTexTest.php.
References $test.
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']);
◆ testRemoveCurlyBraces2()
BibTexTest::testRemoveCurlyBraces2 |
( |
| ) |
|
Definition at line 840 of file BibTexTest.php.
References $test.
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']);
◆ testRemoveCurlyBracesWithoutBraces()
BibTexTest::testRemoveCurlyBracesWithoutBraces |
( |
| ) |
|
Definition at line 857 of file BibTexTest.php.
References $test.
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']);
◆ testRtfExport()
BibTexTest::testRtfExport |
( |
| ) |
|
Definition at line 874 of file BibTexTest.php.
References $test.
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);
◆ testSingleParse()
BibTexTest::testSingleParse |
( |
| ) |
|
Definition at line 159 of file BibTexTest.php.
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());
◆ testWarningAtInBraces()
BibTexTest::testWarningAtInBraces |
( |
| ) |
|
Definition at line 344 of file BibTexTest.php.
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']);
◆ testWarningEscapedDoubleQuote()
BibTexTest::testWarningEscapedDoubleQuote |
( |
| ) |
|
Definition at line 353 of file BibTexTest.php.
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']);
◆ testWarningMultipleEntries()
BibTexTest::testWarningMultipleEntries |
( |
| ) |
|
Definition at line 373 of file BibTexTest.php.
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']);
◆ testWrongBraces3()
BibTexTest::testWrongBraces3 |
( |
| ) |
|
Definition at line 335 of file BibTexTest.php.
References PEAR\isError().
336 $teststring =
"@Article { art1, 338 author = {John {Doe and {Jane Doe} 340 $this->obj->content = $teststring;
isError($data, $code=null)
Tell whether a value is a PEAR error.
◆ $obj
The documentation for this class was generated from the following file: