ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
BibTexTest Class Reference

Test class for Structures_BibTex. More...

+ Inheritance diagram for BibTexTest:
+ Collaboration diagram for BibTexTest:

Public Member Functions

 testLoadFileFileExists ()
 
 testLoadFileFileDoesNotExists ()
 
 test_parseEntry ()
 
 test_checkEqualSignTrue ()
 
 test_checkEqualSignFalse ()
 
 testClearWarnings ()
 
 test_validateValueWarningAtInBraces ()
 
 test_validateValueWarningEscapedDoubleQuoteInsideDoubleQuotes ()
 
 test_validateValueWarningUnbalancedAmountOfBracesOpen ()
 
 test_validateValueWarningUnbalancedAmountOfBracesClosed ()
 
 test_generateWarning ()
 
 testHasWarning ()
 
 testAmount ()
 
 testGetStatistic ()
 
 testSingleParse ()
 
 testMultiParse ()
 
 testParse ()
 
 testBibTex ()
 
 testAddEntry ()
 
 testEntryOverMoreLines ()
 
 testParsingComment ()
 
 testWrongBraces3 ()
 
 testWarningAtInBraces ()
 
 testWarningEscapedDoubleQuote ()
 
 testWarningMultipleEntries ()
 
 testAuthorFirstSimple ()
 
 testAuthorFirstLastCannotBeEmpty ()
 
 testAuthorFirstSimpleLowerCase ()
 
 testAuthorFirstLastCannotBeEmptyLowerCase ()
 
 testAuthorFirstSimpleVon ()
 
 testAuthorFirstSimpleVonInnerUppercase ()
 
 testAuthorFirstDigitsArecaselessUppercase ()
 
 testAuthorFirstDigitsArecaselessLowercase ()
 
 testAuthorFirstPseudoLettersAreCaselessLowerInsideUpperOutside ()
 
 testAuthorFirstPseudoLettersAreCaselessLowerInsideLowerOutside ()
 
 testAuthorFirstPseudoLettersAreCaselessUpperInsideUpperOutside ()
 
 testAuthorFirstPseudoLettersAreCaselessUpperInsideLowerOutside ()
 
 testAuthorFirstNonLettersAreCaselessUpperCase ()
 
 testAuthorFirstNonLettersAreCaselessLowerCase ()
 
 testAuthorFirstGroupingCaselessOne ()
 
 testAuthorFirstGroupingCaselessTwo ()
 
 testAuthorFirstGroupingCaselessThree ()
 
 testAuthorSecondAndThirdSimpleCaseFirstUppercase ()
 
 testAuthorSecondAndThirdSimpleCaseFirstLowercase ()
 
 testAuthorSecondAndThirdSimpleVon ()
 
 testAuthorSecondAndThirdLastPartCoannotBeEmpty ()
 
 testAuthorSecondAndThirdFirstCanBeEmptyAfterComma ()
 
 testAuthorSecondAndThirdSimpleJrUppercase ()
 
 testAuthorSecondAndThirdSimpleJrLowercase ()
 
 testAuthorSecondAndThirdJrCanBeEmptyBetweenCommas ()
 
 testCaseUpperSimple ()
 
 testCaseLowerSimple ()
 
 testCaseCaselessSimple ()
 
 testCaseUpperComplexBrace ()
 
 testCaseLowerComplexBrace ()
 
 testCaseUpperComplexNumber ()
 
 testCaseLowerComplexNumber ()
 
 testCaseUpperComplexWhitespace ()
 
 testCaseLowerComplexWhitespace ()
 
 testCaseErrorEmptyString ()
 
 testCaseErrorNonString ()
 
 testAllowedTypeTrue ()
 
 testAllowedTypeFalse ()
 
 testAllowedTypeWarning ()
 
 testMissingLastBraceParsing ()
 
 testMissingLastBraceParsing2 ()
 
 testMissingLastBraceWarning ()
 
 testNewlineInAuthorField ()
 
 testNotRemoveCurlyBraces ()
 
 testRemoveCurlyBraces ()
 
 testRemoveCurlyBraces2 ()
 
 testRemoveCurlyBracesWithoutBraces ()
 
 testRtfExport ()
 
 testHtmlExport ()
 
 testFormatAuthor ()
 
 testExtractAuthorWhitespace ()
 
 testExtractAuthorTilde ()
 
 testNotExtractAuthors ()
 
 testExtractAuthors ()
 
 testNotExtractAuthorsBibtexExport ()
 
 testNotExtractAuthorsRtfExport ()
 
 testNotExtractAuthorsHtmlExport ()
 

Static Public Member Functions

static main ()
 Runs the test methods of this class. More...
 

Data Fields

 $obj
 

Protected Member Functions

 setUp ()
 Sets up the fixture, for example, open a network connection. More...
 
 tearDown ()
 Tears down the fixture, for example, close a network connection. More...
 

Detailed Description

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.

Member Function Documentation

◆ main()

static BibTexTest::main ( )
static

Runs the test methods of this class.

public

Definition at line 31 of file BibTexTest.php.

References $result, and $suite.

Referenced by testNotExtractAuthorsHtmlExport().

31  {
32  require_once "PHPUnit/TextUI/TestRunner.php";
33  $suite = new PHPUnit_Framework_TestSuite("Structures_BibTexTest");
34  $result = PHPUnit_TextUI_TestRunner::run($suite);
35  }
$suite
$result
+ Here is the caller graph for this function:

◆ setUp()

BibTexTest::setUp ( )
protected

Sets up the fixture, for example, open a network connection.

This method is called before a test is executed.

protected

Definition at line 44 of file BibTexTest.php.

44  {
45  $this->obj = new Structures_BibTex();
46  }

◆ tearDown()

BibTexTest::tearDown ( )
protected

Tears down the fixture, for example, close a network connection.

This method is called after a test is executed.

protected

Definition at line 55 of file BibTexTest.php.

55  {
56  unset($this->obj);
57  }

◆ test_checkEqualSignFalse()

BibTexTest::test_checkEqualSignFalse ( )

Definition at line 93 of file BibTexTest.php.

References $test.

93  {
94  $test = "={=}";
95  $this->assertFalse($this->obj->_checkEqualSign($test, 2));
96  }
$test
Definition: Utf8Test.php:85

◆ test_checkEqualSignTrue()

BibTexTest::test_checkEqualSignTrue ( )

Definition at line 87 of file BibTexTest.php.

References $test.

87  {
88  $test = "={=}";
89  $this->assertTrue($this->obj->_checkEqualSign($test, 0));
90  }
$test
Definition: Utf8Test.php:85

◆ test_generateWarning()

BibTexTest::test_generateWarning ( )

Definition at line 145 of file BibTexTest.php.

References $ret.

145  {
146  $this->obj->clearWarnings();
147  $this->obj->_generateWarning('type', 'entry');
148  $ret = $this->obj->hasWarning();
149  $this->obj->clearWarnings();
150  $this->assertTrue($ret);
151  }

◆ test_parseEntry()

BibTexTest::test_parseEntry ( )
Todo:
Implement test_parseEntry().

Definition at line 76 of file BibTexTest.php.

References $test.

76  {
77  //Remember here that there is no closing brace!
78  $test = "@foo{bar,john=doe";
79  $shouldbe = array();
80  $shouldbe['john'] = 'doe';
81  $shouldbe['cite'] = 'bar';
82  $shouldbe['entryType'] = 'foo';
83  $this->assertEquals($shouldbe, $this->obj->_parseEntry($test));
84  }
$test
Definition: Utf8Test.php:85

◆ test_validateValueWarningAtInBraces()

BibTexTest::test_validateValueWarningAtInBraces ( )

Definition at line 113 of file BibTexTest.php.

References $test.

113  {
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']);
118  }
$test
Definition: Utf8Test.php:85

◆ test_validateValueWarningEscapedDoubleQuoteInsideDoubleQuotes()

BibTexTest::test_validateValueWarningEscapedDoubleQuoteInsideDoubleQuotes ( )

Definition at line 121 of file BibTexTest.php.

References $test.

121  {
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']);
126  }
$test
Definition: Utf8Test.php:85

◆ test_validateValueWarningUnbalancedAmountOfBracesClosed()

BibTexTest::test_validateValueWarningUnbalancedAmountOfBracesClosed ( )

Definition at line 137 of file BibTexTest.php.

References $test.

137  {
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']);
142  }
$test
Definition: Utf8Test.php:85

◆ test_validateValueWarningUnbalancedAmountOfBracesOpen()

BibTexTest::test_validateValueWarningUnbalancedAmountOfBracesOpen ( )

Definition at line 129 of file BibTexTest.php.

References $test.

129  {
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']);
134  }
$test
Definition: Utf8Test.php:85

◆ testAddEntry()

BibTexTest::testAddEntry ( )

Definition at line 243 of file BibTexTest.php.

References $addarray.

243  {
244  $addarray = array();
245  $addarray['type'] = 'Article';
246  $addarray['cite'] = 'art2';
247  $addarray['title'] = 'Titel2';
248  $addarray['author'][0] = 'John Doe';
249  $addarray['author'][1] = 'Jane Doe';
250  $teststring = "@Article { art1,
251 title = {Titel1},
252 author = {John Doe and Jane Doe}
253 }";
254  $this->obj->content = $teststring;
255  $this->obj->parse();
256  $this->obj->addEntry($addarray);
257  $this->assertEquals(2, $this->obj->amount());
258  }

◆ testAllowedTypeFalse()

BibTexTest::testAllowedTypeFalse ( )

Definition at line 781 of file BibTexTest.php.

References $test.

781  {
782  $test = 'foo';
783  $this->assertFalse($this->obj->_checkAllowedEntryType($test));
784  }
$test
Definition: Utf8Test.php:85

◆ testAllowedTypeTrue()

BibTexTest::testAllowedTypeTrue ( )

Definition at line 775 of file BibTexTest.php.

References $test.

775  {
776  $test = 'article';
777  $this->assertTrue($this->obj->_checkAllowedEntryType($test));
778  }
$test
Definition: Utf8Test.php:85

◆ testAllowedTypeWarning()

BibTexTest::testAllowedTypeWarning ( )

Definition at line 787 of file BibTexTest.php.

References $test.

787  {
788  $this->obj->clearWarnings();
789  $test = "@Foo { art1,
790 title = {Titel1},
791 author = {John Doe and Jane Doe}
792 }";
793  $this->obj->content = $test;
794  $this->obj->setOption('validate', true);
795  $this->obj->parse();
796  $this->assertEquals('WARNING_NOT_ALLOWED_ENTRY_TYPE', $this->obj->warnings[0]['warning']);
797  }
$test
Definition: Utf8Test.php:85

◆ testAmount()

BibTexTest::testAmount ( )

Definition at line 160 of file BibTexTest.php.

160  {
161  $teststring = "@Article {art1,author = {John Doe and Jane Doe}}@Article { art2,author = {John Doe and Jane Doe}}";
162  $this->obj->content = $teststring;
163  $this->obj->parse();
164  $this->assertEquals(2, $this->obj->amount());
165  }

◆ testAuthorFirstDigitsArecaselessLowercase()

BibTexTest::testAuthorFirstDigitsArecaselessLowercase ( )

Definition at line 510 of file BibTexTest.php.

References $test.

510  {
511  $test = "AA 1b cc dd";
512  $shouldbe = array();
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));
518  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstDigitsArecaselessUppercase()

BibTexTest::testAuthorFirstDigitsArecaselessUppercase ( )

Definition at line 499 of file BibTexTest.php.

References $test.

499  {
500  $test = "AA 1B cc dd";
501  $shouldbe = array();
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));
507  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstGroupingCaselessOne()

BibTexTest::testAuthorFirstGroupingCaselessOne ( )

Definition at line 587 of file BibTexTest.php.

References $test.

587  {
588  $test = "AA {bb} cc DD";
589  $shouldbe = array();
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));
595  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstGroupingCaselessThree()

BibTexTest::testAuthorFirstGroupingCaselessThree ( )

Definition at line 609 of file BibTexTest.php.

References $test.

609  {
610  $test = "AA {bb} CC";
611  $shouldbe = array();
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));
617  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstGroupingCaselessTwo()

BibTexTest::testAuthorFirstGroupingCaselessTwo ( )

Definition at line 598 of file BibTexTest.php.

References $test.

598  {
599  $test = "AA bb {cc} DD";
600  $shouldbe = array();
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));
606  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstLastCannotBeEmpty()

BibTexTest::testAuthorFirstLastCannotBeEmpty ( )

Definition at line 444 of file BibTexTest.php.

References $test.

444  {
445  $test = "AA";
446  $shouldbe = array();
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));
452  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstLastCannotBeEmptyLowerCase()

BibTexTest::testAuthorFirstLastCannotBeEmptyLowerCase ( )

Definition at line 466 of file BibTexTest.php.

References $test.

466  {
467  $test = "aa";
468  $shouldbe = array();
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));
474  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstNonLettersAreCaselessLowerCase()

BibTexTest::testAuthorFirstNonLettersAreCaselessLowerCase ( )

Definition at line 576 of file BibTexTest.php.

References $test.

576  {
577  $test = "AA \bb{b} cc dd";
578  $shouldbe = array();
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));
584  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstNonLettersAreCaselessUpperCase()

BibTexTest::testAuthorFirstNonLettersAreCaselessUpperCase ( )

Definition at line 565 of file BibTexTest.php.

References $test.

565  {
566  $test = "AA \BB{b} cc dd";
567  $shouldbe = array();
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));
573  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstPseudoLettersAreCaselessLowerInsideLowerOutside()

BibTexTest::testAuthorFirstPseudoLettersAreCaselessLowerInsideLowerOutside ( )

Definition at line 532 of file BibTexTest.php.

References $test.

532  {
533  $test = "AA {b}b cc dd";
534  $shouldbe = array();
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));
540  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstPseudoLettersAreCaselessLowerInsideUpperOutside()

BibTexTest::testAuthorFirstPseudoLettersAreCaselessLowerInsideUpperOutside ( )

Definition at line 521 of file BibTexTest.php.

References $test.

521  {
522  $test = "AA {b}B cc dd";
523  $shouldbe = array();
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));
529  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstPseudoLettersAreCaselessUpperInsideLowerOutside()

BibTexTest::testAuthorFirstPseudoLettersAreCaselessUpperInsideLowerOutside ( )

Definition at line 554 of file BibTexTest.php.

References $test.

554  {
555  $test = "AA {B}b cc dd";
556  $shouldbe = array();
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));
562  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstPseudoLettersAreCaselessUpperInsideUpperOutside()

BibTexTest::testAuthorFirstPseudoLettersAreCaselessUpperInsideUpperOutside ( )

Definition at line 543 of file BibTexTest.php.

References $test.

543  {
544  $test = "AA {B}B cc dd";
545  $shouldbe = array();
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));
551  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstSimple()

BibTexTest::testAuthorFirstSimple ( )

Definition at line 433 of file BibTexTest.php.

References $test.

433  {
434  $test = "AA BB";
435  $shouldbe = array();
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));
441  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstSimpleLowerCase()

BibTexTest::testAuthorFirstSimpleLowerCase ( )

Definition at line 455 of file BibTexTest.php.

References $test.

455  {
456  $test = "AA bb";
457  $shouldbe = array();
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));
463  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstSimpleVon()

BibTexTest::testAuthorFirstSimpleVon ( )

Definition at line 477 of file BibTexTest.php.

References $test.

477  {
478  $test = "AA bb CC";
479  $shouldbe = array();
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));
485  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstSimpleVonInnerUppercase()

BibTexTest::testAuthorFirstSimpleVonInnerUppercase ( )

Definition at line 488 of file BibTexTest.php.

References $test.

488  {
489  $test = "AA bb CC dd EE";
490  $shouldbe = array();
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));
496  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdFirstCanBeEmptyAfterComma()

BibTexTest::testAuthorSecondAndThirdFirstCanBeEmptyAfterComma ( )

Definition at line 664 of file BibTexTest.php.

References $test.

664  {
665  $test = "BB,";
666  $shouldbe = array();
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));
672  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdJrCanBeEmptyBetweenCommas()

BibTexTest::testAuthorSecondAndThirdJrCanBeEmptyBetweenCommas ( )

Definition at line 697 of file BibTexTest.php.

References $test.

697  {
698  $test = "BB,, AA";
699  $shouldbe = array();
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));
705  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdLastPartCoannotBeEmpty()

BibTexTest::testAuthorSecondAndThirdLastPartCoannotBeEmpty ( )

Definition at line 653 of file BibTexTest.php.

References $test.

653  {
654  $test = "bb, AA";
655  $shouldbe = array();
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));
661  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdSimpleCaseFirstLowercase()

BibTexTest::testAuthorSecondAndThirdSimpleCaseFirstLowercase ( )

Definition at line 631 of file BibTexTest.php.

References $test.

631  {
632  $test = "bb CC, aa";
633  $shouldbe = array();
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));
639  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdSimpleCaseFirstUppercase()

BibTexTest::testAuthorSecondAndThirdSimpleCaseFirstUppercase ( )

Definition at line 620 of file BibTexTest.php.

References $test.

620  {
621  $test = "bb CC, AA";
622  $shouldbe = array();
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));
628  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdSimpleJrLowercase()

BibTexTest::testAuthorSecondAndThirdSimpleJrLowercase ( )

Definition at line 686 of file BibTexTest.php.

References $test.

686  {
687  $test = "bb CC,xx, AA";
688  $shouldbe = array();
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));
694  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdSimpleJrUppercase()

BibTexTest::testAuthorSecondAndThirdSimpleJrUppercase ( )

Definition at line 675 of file BibTexTest.php.

References $test.

675  {
676  $test = "bb CC,XX, AA";
677  $shouldbe = array();
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));
683  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdSimpleVon()

BibTexTest::testAuthorSecondAndThirdSimpleVon ( )

Definition at line 642 of file BibTexTest.php.

References $test.

642  {
643  $test = "bb CC dd EE, AA";
644  $shouldbe = array();
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));
650  }
$test
Definition: Utf8Test.php:85

◆ testBibTex()

BibTexTest::testBibTex ( )

Definition at line 224 of file BibTexTest.php.

224  {
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()));
240  }

◆ testCaseCaselessSimple()

BibTexTest::testCaseCaselessSimple ( )

Definition at line 721 of file BibTexTest.php.

References $test.

721  {
722  $test = '{a}';
723  $this->assertEquals(- 1, $this->obj->_determineCase($test));
724  }
$test
Definition: Utf8Test.php:85

◆ testCaseErrorEmptyString()

BibTexTest::testCaseErrorEmptyString ( )

Definition at line 763 of file BibTexTest.php.

References $test, and PEAR\isError().

763  {
764  $test = '';
765  $this->assertTrue(PEAR::isError($this->obj->_determineCase($test)));
766  }
$test
Definition: Utf8Test.php:85
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
+ Here is the call graph for this function:

◆ testCaseErrorNonString()

BibTexTest::testCaseErrorNonString ( )

Definition at line 769 of file BibTexTest.php.

References $test, and PEAR\isError().

769  {
770  $test = 2;
771  $this->assertTrue(PEAR::isError($this->obj->_determineCase($test)));
772  }
$test
Definition: Utf8Test.php:85
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
+ Here is the call graph for this function:

◆ testCaseLowerComplexBrace()

BibTexTest::testCaseLowerComplexBrace ( )

Definition at line 733 of file BibTexTest.php.

References $test.

733  {
734  $test = '{a}a';
735  $this->assertEquals(0, $this->obj->_determineCase($test));
736  }
$test
Definition: Utf8Test.php:85

◆ testCaseLowerComplexNumber()

BibTexTest::testCaseLowerComplexNumber ( )

Definition at line 745 of file BibTexTest.php.

References $test.

745  {
746  $test = '1a';
747  $this->assertEquals(0, $this->obj->_determineCase($test));
748  }
$test
Definition: Utf8Test.php:85

◆ testCaseLowerComplexWhitespace()

BibTexTest::testCaseLowerComplexWhitespace ( )

Definition at line 757 of file BibTexTest.php.

References $test.

757  {
758  $test = ' a';
759  $this->assertEquals(0, $this->obj->_determineCase($test));
760  }
$test
Definition: Utf8Test.php:85

◆ testCaseLowerSimple()

BibTexTest::testCaseLowerSimple ( )

Definition at line 715 of file BibTexTest.php.

References $test.

715  {
716  $test = 'aa';
717  $this->assertEquals(0, $this->obj->_determineCase($test));
718  }
$test
Definition: Utf8Test.php:85

◆ testCaseUpperComplexBrace()

BibTexTest::testCaseUpperComplexBrace ( )

Definition at line 727 of file BibTexTest.php.

References $test.

727  {
728  $test = '{A}A';
729  $this->assertEquals(1, $this->obj->_determineCase($test));
730  }
$test
Definition: Utf8Test.php:85

◆ testCaseUpperComplexNumber()

BibTexTest::testCaseUpperComplexNumber ( )

Definition at line 739 of file BibTexTest.php.

References $test.

739  {
740  $test = '1A';
741  $this->assertEquals(1, $this->obj->_determineCase($test));
742  }
$test
Definition: Utf8Test.php:85

◆ testCaseUpperComplexWhitespace()

BibTexTest::testCaseUpperComplexWhitespace ( )

Definition at line 751 of file BibTexTest.php.

References $test.

751  {
752  $test = ' A';
753  $this->assertEquals(1, $this->obj->_determineCase($test));
754  }
$test
Definition: Utf8Test.php:85

◆ testCaseUpperSimple()

BibTexTest::testCaseUpperSimple ( )

Definition at line 709 of file BibTexTest.php.

References $test.

709  {
710  $test = 'AA';
711  $this->assertEquals(1, $this->obj->_determineCase($test));
712  }
$test
Definition: Utf8Test.php:85

◆ testClearWarnings()

BibTexTest::testClearWarnings ( )

Definition at line 99 of file BibTexTest.php.

99  {
100  $this->obj->clearWarnings();
101  $this->obj->_generateWarning('type', 'entry');
102  $this->obj->clearWarnings();
103  $this->assertFalse($this->obj->hasWarning());
104  }

◆ testEntryOverMoreLines()

BibTexTest::testEntryOverMoreLines ( )

Definition at line 261 of file BibTexTest.php.

261  {
262  //Entry found at http://en.wikipedia.org/wiki/BibTeX
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\",
268  year = 1964,
269  address = \"New York\",
270  edition = \"ninth Dover printing, tenth GPO printing\",
271  isbn = \"0-486-61272-4\"
272 }";
273  $shouldbe = array();
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;
292  $this->obj->parse();
293  $this->assertEquals($shouldbe, $this->obj->data);
294  }

◆ testExtractAuthors()

BibTexTest::testExtractAuthors ( )

Definition at line 1099 of file BibTexTest.php.

References $test.

1099  {
1100  $this->obj->clearWarnings();
1101  $test = '
1102 @phdthesis{foo4,
1103 author = {John Doe},
1104 }
1105  ';
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']);
1115  }
$test
Definition: Utf8Test.php:85

◆ testExtractAuthorTilde()

BibTexTest::testExtractAuthorTilde ( )

Definition at line 1073 of file BibTexTest.php.

References $test.

1073  {
1074  $test = 'John~Doe';
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));
1081  }
$test
Definition: Utf8Test.php:85

◆ testExtractAuthorWhitespace()

BibTexTest::testExtractAuthorWhitespace ( )

Definition at line 1062 of file BibTexTest.php.

References $test.

1062  {
1063  $test = 'John Doe';
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));
1070  }
$test
Definition: Utf8Test.php:85

◆ testFormatAuthor()

BibTexTest::testFormatAuthor ( )

Definition at line 1038 of file BibTexTest.php.

References $test.

1038  {
1039  $test = '
1040 @phdthesis{foo4,
1041 author = {von Last, Jr ,First}
1042 }
1043  ';
1044  $shouldbe = 'von Last Jr First';
1045  $this->obj->content = $test;
1046  /*Setting formating option and saving old state*/
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();
1053  /*Dropping tags and trimming*/
1054  $html = trim(strip_tags($html));
1055  /*Resetting old state*/
1056  $this->obj->htmlstring = $oldhtmlstring;
1057  $this->obj->authorstring = $oldauthorstring;
1058  $this->assertEquals($shouldbe, $html);
1059  }
$test
Definition: Utf8Test.php:85

◆ testGetStatistic()

BibTexTest::testGetStatistic ( )

Definition at line 168 of file BibTexTest.php.

168  {
169  $teststring = "@Article {art1,author = {John Doe and Jane Doe}}@Article { art2,author = {John Doe and Jane Doe}}";
170  $this->obj->content = $teststring;
171  $this->obj->parse();
172  $shouldbe = array();
173  $shouldbe['article'] = 2;
174  $this->assertEquals($shouldbe, $this->obj->getStatistic());
175  }

◆ testHasWarning()

BibTexTest::testHasWarning ( )

Definition at line 154 of file BibTexTest.php.

154  {
155  $this->obj->clearWarnings();
156  $this->assertFalse($this->obj->hasWarning());
157  }

◆ testHtmlExport()

BibTexTest::testHtmlExport ( )

Definition at line 1010 of file BibTexTest.php.

References $test.

1010  {
1011  $test = '
1012 @phdthesis{foo4,
1013 title = {title},
1014 author = {author},
1015 journal = {journal},
1016 year = {year}
1017 }
1018  ';
1019  $shouldbe = '<p>
1020 author title journal year
1021 </p>
1022 ';
1023  $this->obj->content = $test;
1024  /*Setting formating option and saving old state*/
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();
1031  /*Resetting old state*/
1032  $this->obj->htmlstring = $oldhtmlstring;
1033  $this->obj->authorstring = $oldauthorstring;
1034  $this->assertEquals($shouldbe, $html);
1035  }
$test
Definition: Utf8Test.php:85

◆ testLoadFileFileDoesNotExists()

BibTexTest::testLoadFileFileDoesNotExists ( )

Definition at line 67 of file BibTexTest.php.

References $ret, and PEAR\isError().

67  {
68  $ret = $this->obj->loadFile((string)time());
69  $this->assertTrue(PEAR::isError($ret));
70  }
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
+ Here is the call graph for this function:

◆ testLoadFileFileExists()

BibTexTest::testLoadFileFileExists ( )

Definition at line 60 of file BibTexTest.php.

References $ret.

60  {
61  $ret = $this->obj->loadFile("BibTexTest.php");
62  $this->content = ''; //Erasing the loaded content again because it is senseless
63  $this->assertTrue($ret);
64  }

◆ testMissingLastBraceParsing()

BibTexTest::testMissingLastBraceParsing ( )

Definition at line 800 of file BibTexTest.php.

References $test.

800  {
801  $this->obj->clearWarnings();
802  $test = '
803 @phdthesis{foo1,
804 school = {school1},
805 title = {title1},
806 author = {author1},
807 year = {year1}
808 }
809 @phdthesis{foo2,
810 school = {school2},
811 title = {title2},
812 author = {author2},
813 year = {year2}
814 
815 @phdthesis{foo3,
816 school = {school3},
817 title = {title3},
818 author = {author3},
819 year = {year3}
820 }
821 @phdthesis{foo4,
822 school = {school4},
823 title = {title4},
824 author = {author4},
825 year = {year4}
826 }
827  ';
828  $this->obj->content = $test;
829  $this->obj->setOption('validate', true);
830  $this->obj->parse();
831  $this->assertEquals($this->obj->amount(), 4);
832  }
$test
Definition: Utf8Test.php:85

◆ testMissingLastBraceParsing2()

BibTexTest::testMissingLastBraceParsing2 ( )

Definition at line 835 of file BibTexTest.php.

References $test.

835  {
836  $this->obj->clearWarnings();
837  $test = '
838 @phdthesis{foo1,
839 school = {school1},
840 title = {title1},
841 author = {author1},
842 year = {year1}
843  ';
844  $this->obj->content = $test;
845  $this->obj->setOption('validate', true);
846  $this->obj->parse();
847  $this->assertEquals($this->obj->amount(), 1);
848  }
$test
Definition: Utf8Test.php:85

◆ testMissingLastBraceWarning()

BibTexTest::testMissingLastBraceWarning ( )

Definition at line 851 of file BibTexTest.php.

References $test.

851  {
852  $this->obj->clearWarnings();
853  $test = '
854 @phdthesis{foo1,
855 school = {school1},
856 title = {title1},
857 author = {author1},
858 year = {year1}
859 }
860 @phdthesis{foo2,
861 school = {school2},
862 title = {title2},
863 author = {author2},
864 year = {year2}
865 
866 @phdthesis{foo3,
867 school = {school3},
868 title = {title3},
869 author = {author3},
870 year = {year3}
871 }
872 @phdthesis{foo4,
873 school = {school4},
874 title = {title4},
875 author = {author4},
876 year = {year4}
877 }
878  ';
879  $this->obj->content = $test;
880  $this->obj->setOption('validate', true);
881  $this->obj->parse();
882  $this->assertEquals($this->obj->warnings[0]['warning'], 'WARNING_MISSING_END_BRACE');
883  }
$test
Definition: Utf8Test.php:85

◆ testMultiParse()

BibTexTest::testMultiParse ( )

Definition at line 188 of file BibTexTest.php.

188  {
189  $teststring = "@Article { art1,
190 author = {John Doe and Jane Doe}
191 }
192 @Article { art2,
193 author = {John Doe and Jane Doe}
194 }";
195  $this->obj->content = $teststring;
196  $this->obj->parse();
197  $this->assertEquals(2, $this->obj->amount());
198  }

◆ testNewlineInAuthorField()

BibTexTest::testNewlineInAuthorField ( )

Definition at line 886 of file BibTexTest.php.

References $test.

886  {
887  $this->obj->clearWarnings();
888  $test = '
889 @phdthesis{foo1,
890 school = {school1},
891 title = {title1},
892 author = {author1 and
893 author2},
894 year = {year1}
895 }
896  ';
897  $shouldbe = array(
898  array( 'first' => '', 'von' => '', 'last' => 'author1', 'jr' => '' ),
899  array( 'first' => '', 'von' => '', 'last' => 'author2', 'jr' => '' )
900  );
901  $this->obj->content = $test;
902  $this->obj->setOption('unwrap', false);
903  $this->obj->parse();
904  $this->assertEquals($shouldbe, $this->obj->data[0]['author']);
905  }
$test
Definition: Utf8Test.php:85

◆ testNotExtractAuthors()

BibTexTest::testNotExtractAuthors ( )

Definition at line 1084 of file BibTexTest.php.

References $test.

1084  {
1085  $this->obj->clearWarnings();
1086  $test = '
1087 @phdthesis{foo4,
1088 author = {John Doe},
1089 }
1090  ';
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']);
1096  }
$test
Definition: Utf8Test.php:85

◆ testNotExtractAuthorsBibtexExport()

BibTexTest::testNotExtractAuthorsBibtexExport ( )

Definition at line 1118 of file BibTexTest.php.

References $test.

1118  {
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());
1125  }
$test
Definition: Utf8Test.php:85

◆ testNotExtractAuthorsHtmlExport()

BibTexTest::testNotExtractAuthorsHtmlExport ( )

Definition at line 1142 of file BibTexTest.php.

References $test, and main().

1142  {
1143  $this->obj->clearWarnings();
1144  $test = "@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1145  $shouldbe = '<p>
1146 John Doe, "<strong></strong>", <em></em>, <br />
1147 </p>
1148 ';
1149  $this->obj->content = $test;
1150  $this->obj->setOption('extractAuthors', false);
1151  $this->obj->parse();
1152  $this->assertEquals($shouldbe, $this->obj->html());
1153  }
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:

◆ testNotExtractAuthorsRtfExport()

BibTexTest::testNotExtractAuthorsRtfExport ( )

Definition at line 1128 of file BibTexTest.php.

References $test.

1128  {
1129  $this->obj->clearWarnings();
1130  $test = "@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1131  $shouldbe = '{\rtf
1132 John Doe, "{\b }", {\i },
1133 \par
1134 }';
1135  $this->obj->content = $test;
1136  $this->obj->setOption('extractAuthors', false);
1137  $this->obj->parse();
1138  $this->assertEquals($shouldbe, $this->obj->rtf());
1139  }
$test
Definition: Utf8Test.php:85

◆ testNotRemoveCurlyBraces()

BibTexTest::testNotRemoveCurlyBraces ( )

Definition at line 908 of file BibTexTest.php.

References $test.

908  {
909  $this->obj->clearWarnings();
910  $test = '
911 @phdthesis{foo4,
912 school = {school4},
913 title = {Do {S}omething},
914 author = {author4},
915 year = {year4}
916 }
917  ';
918  $shouldbe = 'Do {S}omething';
919  $this->obj->content = $test;
920  $this->obj->setOption('removeCurlyBraces', false);
921  $this->obj->parse();
922  //print_r($this->obj->data[0]['author']);
923  $this->assertEquals($shouldbe, $this->obj->data[0]['title']);
924  }
$test
Definition: Utf8Test.php:85

◆ testParse()

BibTexTest::testParse ( )

Definition at line 201 of file BibTexTest.php.

201  {
202  $teststring = "@Article { art1,
203 title = {Titel1},
204 author = {John Doe and Jane Doe}
205 }";
206  $shouldbe = array();
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;
219  $this->obj->parse();
220  $this->assertEquals($shouldbe, $this->obj->data);
221  }

◆ testParsingComment()

BibTexTest::testParsingComment ( )

Definition at line 297 of file BibTexTest.php.

297  {
298  $teststring = "@Article { art1,
299 title = {Titel1},
300 author = {John Doe and Jane Doe}
301 }
302 Here is a comment
303 @Article { art2,
304 title = {Titel2},
305 author = {John Doe and Jane Doe}
306 }";
307  $shouldbe = array();
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;
331  $this->obj->parse();
332  $this->assertTrue($this->obj->data == $shouldbe);
333  }

◆ testRemoveCurlyBraces()

BibTexTest::testRemoveCurlyBraces ( )

Definition at line 927 of file BibTexTest.php.

References $test.

927  {
928  $this->obj->clearWarnings();
929  $test = '
930 @phdthesis{foo4,
931 school = {school4},
932 title = {Do {S}omething},
933 author = {author4},
934 year = {year4}
935 }
936  ';
937  $shouldbe = 'Do Something';
938  $this->obj->content = $test;
939  $this->obj->setOption('removeCurlyBraces', true);
940  $this->obj->parse();
941  //print_r($this->obj->data[0]['author']);
942  $this->assertEquals($shouldbe, $this->obj->data[0]['title']);
943  }
$test
Definition: Utf8Test.php:85

◆ testRemoveCurlyBraces2()

BibTexTest::testRemoveCurlyBraces2 ( )

Definition at line 946 of file BibTexTest.php.

References $test.

946  {
947  $this->obj->clearWarnings();
948  $test = '
949 @phdthesis{foo4,
950 school = {school4},
951 title = {Do {S}o{me\}th}ing},
952 author = {author4},
953 year = {year4}
954 }
955  ';
956  $shouldbe = 'Do Some\}thing';
957  $this->obj->content = $test;
958  $this->obj->setOption('removeCurlyBraces', true);
959  $this->obj->parse();
960  $this->assertEquals($shouldbe, $this->obj->data[0]['title']);
961  }
$test
Definition: Utf8Test.php:85

◆ testRemoveCurlyBracesWithoutBraces()

BibTexTest::testRemoveCurlyBracesWithoutBraces ( )

Definition at line 964 of file BibTexTest.php.

References $test.

964  {
965  $this->obj->clearWarnings();
966  $test = '
967 @phdthesis{foo4,
968 school = {school4},
969 title = {Do Something},
970 author = {author4},
971 year = {year4}
972 }
973  ';
974  $shouldbe = 'Do Something';
975  $this->obj->content = $test;
976  $this->obj->setOption('removeCurlyBraces', true);
977  $this->obj->parse();
978  $this->assertEquals($shouldbe, $this->obj->data[0]['title']);
979  }
$test
Definition: Utf8Test.php:85

◆ testRtfExport()

BibTexTest::testRtfExport ( )

Definition at line 982 of file BibTexTest.php.

References $test.

982  {
983  $test = '
984 @phdthesis{foo4,
985 title = {title},
986 author = {author},
987 journal = {journal},
988 year = {year}
989 }
990  ';
991  $shouldbe = '{\rtf
992 author title journal year
993 \par
994 }';
995  $this->obj->content = $test;
996  /*Setting formating option and saving old state*/
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();
1003  /*Resetting old state*/
1004  $this->obj->rtfstring = $oldrtfstring;
1005  $this->obj->authorstring = $oldauthorstring;
1006  $this->assertEquals($shouldbe, $rtf);
1007  }
$test
Definition: Utf8Test.php:85

◆ testSingleParse()

BibTexTest::testSingleParse ( )

Definition at line 178 of file BibTexTest.php.

178  {
179  $teststring = "@Article { ppm_jon:1991,
180 author = {John Doe and Jane Doe}
181 }";
182  $this->obj->content = $teststring;
183  $this->obj->parse();
184  $this->assertEquals(1, $this->obj->amount());
185  }

◆ testWarningAtInBraces()

BibTexTest::testWarningAtInBraces ( )

Definition at line 365 of file BibTexTest.php.

365  {
366  $teststring = "@Article { art1,
367 title = {Titel1},
368 author = {John Doe and @Jane Doe}
369 }";
370  $this->obj->content = $teststring;
371  $this->obj->parse();
372  $this->assertTrue('WARNING_AT_IN_BRACES' == $this->obj->warnings[0]['warning']);
373  }

◆ testWarningEscapedDoubleQuote()

BibTexTest::testWarningEscapedDoubleQuote ( )

Definition at line 376 of file BibTexTest.php.

376  {
377  $teststring = "@Article { art1,
378 title = {Titel1},
379 author = \"John Doe and \\\"Jane Doe\"
380 }";
381  $this->obj->content = $teststring;
382  $this->obj->parse();
383  $this->assertTrue('WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES' == $this->obj->warnings[0]['warning']);
384  }

◆ testWarningMultipleEntries()

BibTexTest::testWarningMultipleEntries ( )

Definition at line 398 of file BibTexTest.php.

398  {
399  $teststring = "@Article { art1,
400 title = {Titel1},
401 author = {John Doe and Jane Doe}
402 }
403 @Article { art2,
404 title = {Titel1},
405 author = {John Doe and Jane Doe}
406 }
407 @Article { art1,
408 title = {Titel1},
409 author = {John Doe and Jane Doe}
410 }
411 @Article { art2,
412 title = {Titel1},
413 author = {John Doe and Jane Doe}
414 }
415 @Article { art3,
416 title = {Titel1},
417 author = {John Doe and Jane Doe}
418 }";
419  $this->obj->content = $teststring;
420  $this->obj->parse();
421  $this->assertTrue('WARNING_MULTIPLE_ENTRIES' == $this->obj->warnings[0]['warning']);
422  }

◆ testWrongBraces3()

BibTexTest::testWrongBraces3 ( )

Definition at line 355 of file BibTexTest.php.

References PEAR\isError().

355  {
356  $teststring = "@Article { art1,
357 title = {Titel1},
358 author = {John {Doe and {Jane Doe}
359 }";
360  $this->obj->content = $teststring;
361  $this->assertTrue(PEAR::isError($this->obj->parse()));
362  }
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
+ Here is the call graph for this function:

Field Documentation

◆ $obj

BibTexTest::$obj

Definition at line 22 of file BibTexTest.php.


The documentation for this class was generated from the following file: