ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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 30 of file BibTexTest.php.

References $result, and $suite.

Referenced by testNotExtractAuthorsHtmlExport().

30  {
31  require_once "PHPUnit/TextUI/TestRunner.php";
32  $suite = new PHPUnit_Framework_TestSuite("Structures_BibTexTest");
33  $result = PHPUnit_TextUI_TestRunner::run($suite);
34  }
$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 42 of file BibTexTest.php.

42  {
43  $this->obj = new Structures_BibTex();
44  }

◆ 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 52 of file BibTexTest.php.

52  {
53  unset($this->obj);
54  }

◆ test_checkEqualSignFalse()

BibTexTest::test_checkEqualSignFalse ( )

Definition at line 84 of file BibTexTest.php.

References $test.

84  {
85  $test = "={=}";
86  $this->assertFalse($this->obj->_checkEqualSign($test,2));
87  }
$test
Definition: Utf8Test.php:85

◆ test_checkEqualSignTrue()

BibTexTest::test_checkEqualSignTrue ( )

Definition at line 80 of file BibTexTest.php.

References $test.

80  {
81  $test = "={=}";
82  $this->assertTrue($this->obj->_checkEqualSign($test,0));
83  }
$test
Definition: Utf8Test.php:85

◆ test_generateWarning()

BibTexTest::test_generateWarning ( )

Definition at line 127 of file BibTexTest.php.

References $ret.

127  {
128  $this->obj->clearWarnings();
129  $this->obj->_generateWarning('type', 'entry');
130  $ret = $this->obj->hasWarning();
131  $this->obj->clearWarnings();
132  $this->assertTrue($ret);
133  }

◆ test_parseEntry()

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

Definition at line 70 of file BibTexTest.php.

References $test.

70  {
71  //Remember here that there is no closing brace!
72  $test = "@foo{bar,john=doe";
73  $shouldbe = array();
74  $shouldbe['john'] = 'doe';
75  $shouldbe['cite'] = 'bar';
76  $shouldbe['entryType'] = 'foo';
77  $this->assertEquals($shouldbe, $this->obj->_parseEntry($test));
78  }
$test
Definition: Utf8Test.php:85

◆ test_validateValueWarningAtInBraces()

BibTexTest::test_validateValueWarningAtInBraces ( )

Definition at line 102 of file BibTexTest.php.

References $test.

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

◆ test_validateValueWarningEscapedDoubleQuoteInsideDoubleQuotes()

BibTexTest::test_validateValueWarningEscapedDoubleQuoteInsideDoubleQuotes ( )

Definition at line 108 of file BibTexTest.php.

References $test.

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

◆ test_validateValueWarningUnbalancedAmountOfBracesClosed()

BibTexTest::test_validateValueWarningUnbalancedAmountOfBracesClosed ( )

Definition at line 120 of file BibTexTest.php.

References $test.

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

◆ test_validateValueWarningUnbalancedAmountOfBracesOpen()

BibTexTest::test_validateValueWarningUnbalancedAmountOfBracesOpen ( )

Definition at line 114 of file BibTexTest.php.

References $test.

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

◆ testAddEntry()

BibTexTest::testAddEntry ( )

Definition at line 224 of file BibTexTest.php.

References $addarray.

225  {
226  $addarray = array();
227  $addarray['type'] = 'Article';
228  $addarray['cite'] = 'art2';
229  $addarray['title'] = 'Titel2';
230  $addarray['author'][0] = 'John Doe';
231  $addarray['author'][1] = 'Jane Doe';
232  $teststring = "@Article { art1,
233 title = {Titel1},
234 author = {John Doe and Jane Doe}
235 }";
236  $this->obj->content = $teststring;
237  $this->obj->parse();
238  $this->obj->addEntry($addarray);
239  $this->assertEquals(2,$this->obj->amount());
240  }

◆ testAllowedTypeFalse()

BibTexTest::testAllowedTypeFalse ( )

Definition at line 686 of file BibTexTest.php.

References $test.

686  {
687  $test = 'foo';
688  $this->assertFalse($this->obj->_checkAllowedEntryType($test));
689  }
$test
Definition: Utf8Test.php:85

◆ testAllowedTypeTrue()

BibTexTest::testAllowedTypeTrue ( )

Definition at line 682 of file BibTexTest.php.

References $test.

682  {
683  $test = 'article';
684  $this->assertTrue($this->obj->_checkAllowedEntryType($test));
685  }
$test
Definition: Utf8Test.php:85

◆ testAllowedTypeWarning()

BibTexTest::testAllowedTypeWarning ( )

Definition at line 691 of file BibTexTest.php.

References $test.

691  {
692  $this->obj->clearWarnings();
693  $test = "@Foo { art1,
694 title = {Titel1},
695 author = {John Doe and Jane Doe}
696 }";
697  $this->obj->content = $test;
698  $this->obj->setOption('validate', true);
699  $this->obj->parse();
700  $this->assertEquals('WARNING_NOT_ALLOWED_ENTRY_TYPE', $this->obj->warnings[0]['warning']);
701  }
$test
Definition: Utf8Test.php:85

◆ testAmount()

BibTexTest::testAmount ( )

Definition at line 141 of file BibTexTest.php.

142  {
143  $teststring = "@Article {art1,author = {John Doe and Jane Doe}}@Article { art2,author = {John Doe and Jane Doe}}";
144  $this->obj->content = $teststring;
145  $this->obj->parse();
146  $this->assertEquals(2, $this->obj->amount());
147  }

◆ testAuthorFirstDigitsArecaselessLowercase()

BibTexTest::testAuthorFirstDigitsArecaselessLowercase ( )

Definition at line 474 of file BibTexTest.php.

References $test.

474  {
475  $test = "AA 1b cc dd";
476  $shouldbe = array();
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));
482  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstDigitsArecaselessUppercase()

BibTexTest::testAuthorFirstDigitsArecaselessUppercase ( )

Definition at line 465 of file BibTexTest.php.

References $test.

465  {
466  $test = "AA 1B cc dd";
467  $shouldbe = array();
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));
473  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstGroupingCaselessOne()

BibTexTest::testAuthorFirstGroupingCaselessOne ( )

Definition at line 537 of file BibTexTest.php.

References $test.

537  {
538  $test = "AA {bb} cc DD";
539  $shouldbe = array();
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));
545  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstGroupingCaselessThree()

BibTexTest::testAuthorFirstGroupingCaselessThree ( )

Definition at line 555 of file BibTexTest.php.

References $test.

555  {
556  $test = "AA {bb} CC";
557  $shouldbe = array();
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));
563  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstGroupingCaselessTwo()

BibTexTest::testAuthorFirstGroupingCaselessTwo ( )

Definition at line 546 of file BibTexTest.php.

References $test.

546  {
547  $test = "AA bb {cc} DD";
548  $shouldbe = array();
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));
554  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstLastCannotBeEmpty()

BibTexTest::testAuthorFirstLastCannotBeEmpty ( )

Definition at line 417 of file BibTexTest.php.

References $test.

417  {
418  $test = "AA";
419  $shouldbe = array();
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));
425  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstLastCannotBeEmptyLowerCase()

BibTexTest::testAuthorFirstLastCannotBeEmptyLowerCase ( )

Definition at line 437 of file BibTexTest.php.

References $test.

437  {
438  $test = "aa";
439  $shouldbe = array();
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));
445  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstNonLettersAreCaselessLowerCase()

BibTexTest::testAuthorFirstNonLettersAreCaselessLowerCase ( )

Definition at line 528 of file BibTexTest.php.

References $test.

528  {
529  $test = "AA \bb{b} cc dd";
530  $shouldbe = array();
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));
536  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstNonLettersAreCaselessUpperCase()

BibTexTest::testAuthorFirstNonLettersAreCaselessUpperCase ( )

Definition at line 519 of file BibTexTest.php.

References $test.

519  {
520  $test = "AA \BB{b} cc dd";
521  $shouldbe = array();
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));
527  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstPseudoLettersAreCaselessLowerInsideLowerOutside()

BibTexTest::testAuthorFirstPseudoLettersAreCaselessLowerInsideLowerOutside ( )

Definition at line 492 of file BibTexTest.php.

References $test.

492  {
493  $test = "AA {b}b cc dd";
494  $shouldbe = array();
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));
500  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstPseudoLettersAreCaselessLowerInsideUpperOutside()

BibTexTest::testAuthorFirstPseudoLettersAreCaselessLowerInsideUpperOutside ( )

Definition at line 483 of file BibTexTest.php.

References $test.

483  {
484  $test = "AA {b}B cc dd";
485  $shouldbe = array();
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));
491  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstPseudoLettersAreCaselessUpperInsideLowerOutside()

BibTexTest::testAuthorFirstPseudoLettersAreCaselessUpperInsideLowerOutside ( )

Definition at line 510 of file BibTexTest.php.

References $test.

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

◆ testAuthorFirstPseudoLettersAreCaselessUpperInsideUpperOutside()

BibTexTest::testAuthorFirstPseudoLettersAreCaselessUpperInsideUpperOutside ( )

Definition at line 501 of file BibTexTest.php.

References $test.

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

◆ testAuthorFirstSimple()

BibTexTest::testAuthorFirstSimple ( )

Definition at line 407 of file BibTexTest.php.

References $test.

407  {
408  $test = "AA BB";
409  $shouldbe = array();
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));
415  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstSimpleLowerCase()

BibTexTest::testAuthorFirstSimpleLowerCase ( )

Definition at line 427 of file BibTexTest.php.

References $test.

427  {
428  $test = "AA bb";
429  $shouldbe = array();
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));
435  }
$test
Definition: Utf8Test.php:85

◆ testAuthorFirstSimpleVon()

BibTexTest::testAuthorFirstSimpleVon ( )

Definition at line 447 of file BibTexTest.php.

References $test.

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

◆ testAuthorFirstSimpleVonInnerUppercase()

BibTexTest::testAuthorFirstSimpleVonInnerUppercase ( )

Definition at line 456 of file BibTexTest.php.

References $test.

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

◆ testAuthorSecondAndThirdFirstCanBeEmptyAfterComma()

BibTexTest::testAuthorSecondAndThirdFirstCanBeEmptyAfterComma ( )

Definition at line 600 of file BibTexTest.php.

References $test.

600  {
601  $test = "BB,";
602  $shouldbe = array();
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));
608  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdJrCanBeEmptyBetweenCommas()

BibTexTest::testAuthorSecondAndThirdJrCanBeEmptyBetweenCommas ( )

Definition at line 627 of file BibTexTest.php.

References $test.

627  {
628  $test = "BB,, AA";
629  $shouldbe = array();
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));
635  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdLastPartCoannotBeEmpty()

BibTexTest::testAuthorSecondAndThirdLastPartCoannotBeEmpty ( )

Definition at line 591 of file BibTexTest.php.

References $test.

591  {
592  $test = "bb, AA";
593  $shouldbe = array();
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));
599  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdSimpleCaseFirstLowercase()

BibTexTest::testAuthorSecondAndThirdSimpleCaseFirstLowercase ( )

Definition at line 573 of file BibTexTest.php.

References $test.

573  {
574  $test = "bb CC, aa";
575  $shouldbe = array();
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));
581  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdSimpleCaseFirstUppercase()

BibTexTest::testAuthorSecondAndThirdSimpleCaseFirstUppercase ( )

Definition at line 564 of file BibTexTest.php.

References $test.

564  {
565  $test = "bb CC, AA";
566  $shouldbe = array();
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));
572  }
$test
Definition: Utf8Test.php:85

◆ testAuthorSecondAndThirdSimpleJrLowercase()

BibTexTest::testAuthorSecondAndThirdSimpleJrLowercase ( )

Definition at line 618 of file BibTexTest.php.

References $test.

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

◆ testAuthorSecondAndThirdSimpleJrUppercase()

BibTexTest::testAuthorSecondAndThirdSimpleJrUppercase ( )

Definition at line 609 of file BibTexTest.php.

References $test.

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

◆ testAuthorSecondAndThirdSimpleVon()

BibTexTest::testAuthorSecondAndThirdSimpleVon ( )

Definition at line 582 of file BibTexTest.php.

References $test.

582  {
583  $test = "bb CC dd EE, AA";
584  $shouldbe = array();
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));
590  }
$test
Definition: Utf8Test.php:85

◆ testBibTex()

BibTexTest::testBibTex ( )

Definition at line 205 of file BibTexTest.php.

206  {
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()));
222  }

◆ testCaseCaselessSimple()

BibTexTest::testCaseCaselessSimple ( )

Definition at line 645 of file BibTexTest.php.

References $test.

645  {
646  $test = '{a}';
647  $this->assertEquals(-1, $this->obj->_determineCase($test));
648  }
$test
Definition: Utf8Test.php:85

◆ testCaseErrorEmptyString()

BibTexTest::testCaseErrorEmptyString ( )

Definition at line 673 of file BibTexTest.php.

References $test, and PEAR\isError().

673  {
674  $test = '';
675  $this->assertTrue(PEAR::isError($this->obj->_determineCase($test)));
676  }
$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 677 of file BibTexTest.php.

References $test, and PEAR\isError().

677  {
678  $test = 2;
679  $this->assertTrue(PEAR::isError($this->obj->_determineCase($test)));
680  }
$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 653 of file BibTexTest.php.

References $test.

653  {
654  $test = '{a}a';
655  $this->assertEquals(0, $this->obj->_determineCase($test));
656  }
$test
Definition: Utf8Test.php:85

◆ testCaseLowerComplexNumber()

BibTexTest::testCaseLowerComplexNumber ( )

Definition at line 661 of file BibTexTest.php.

References $test.

661  {
662  $test = '1a';
663  $this->assertEquals(0, $this->obj->_determineCase($test));
664  }
$test
Definition: Utf8Test.php:85

◆ testCaseLowerComplexWhitespace()

BibTexTest::testCaseLowerComplexWhitespace ( )

Definition at line 669 of file BibTexTest.php.

References $test.

669  {
670  $test = ' a';
671  $this->assertEquals(0, $this->obj->_determineCase($test));
672  }
$test
Definition: Utf8Test.php:85

◆ testCaseLowerSimple()

BibTexTest::testCaseLowerSimple ( )

Definition at line 641 of file BibTexTest.php.

References $test.

641  {
642  $test = 'aa';
643  $this->assertEquals(0, $this->obj->_determineCase($test));
644  }
$test
Definition: Utf8Test.php:85

◆ testCaseUpperComplexBrace()

BibTexTest::testCaseUpperComplexBrace ( )

Definition at line 649 of file BibTexTest.php.

References $test.

649  {
650  $test = '{A}A';
651  $this->assertEquals(1, $this->obj->_determineCase($test));
652  }
$test
Definition: Utf8Test.php:85

◆ testCaseUpperComplexNumber()

BibTexTest::testCaseUpperComplexNumber ( )

Definition at line 657 of file BibTexTest.php.

References $test.

657  {
658  $test = '1A';
659  $this->assertEquals(1, $this->obj->_determineCase($test));
660  }
$test
Definition: Utf8Test.php:85

◆ testCaseUpperComplexWhitespace()

BibTexTest::testCaseUpperComplexWhitespace ( )

Definition at line 665 of file BibTexTest.php.

References $test.

665  {
666  $test = ' A';
667  $this->assertEquals(1, $this->obj->_determineCase($test));
668  }
$test
Definition: Utf8Test.php:85

◆ testCaseUpperSimple()

BibTexTest::testCaseUpperSimple ( )

Definition at line 637 of file BibTexTest.php.

References $test.

637  {
638  $test = 'AA';
639  $this->assertEquals(1, $this->obj->_determineCase($test));
640  }
$test
Definition: Utf8Test.php:85

◆ testClearWarnings()

BibTexTest::testClearWarnings ( )

Definition at line 89 of file BibTexTest.php.

89  {
90  $this->obj->clearWarnings();
91  $this->obj->_generateWarning('type', 'entry');
92  $this->obj->clearWarnings();
93  $this->assertFalse($this->obj->hasWarning());
94  }

◆ testEntryOverMoreLines()

BibTexTest::testEntryOverMoreLines ( )

Definition at line 242 of file BibTexTest.php.

243  {
244  //Entry found at http://en.wikipedia.org/wiki/BibTeX
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\",
250  year = 1964,
251  address = \"New York\",
252  edition = \"ninth Dover printing, tenth GPO printing\",
253  isbn = \"0-486-61272-4\"
254 }";
255  $shouldbe = array();
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;
274  $this->obj->parse();
275  $this->assertEquals($shouldbe, $this->obj->data);
276  }

◆ testExtractAuthors()

BibTexTest::testExtractAuthors ( )

Definition at line 991 of file BibTexTest.php.

References $test.

991  {
992  $this->obj->clearWarnings();
993  $test = '
994 @phdthesis{foo4,
995 author = {John Doe},
996 }
997  ';
998  $shouldbe = array();
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']);
1007  }
$test
Definition: Utf8Test.php:85

◆ testExtractAuthorTilde()

BibTexTest::testExtractAuthorTilde ( )

Definition at line 967 of file BibTexTest.php.

References $test.

967  {
968  $test = 'John~Doe';
969  $shouldbe = array();
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));
975  }
$test
Definition: Utf8Test.php:85

◆ testExtractAuthorWhitespace()

BibTexTest::testExtractAuthorWhitespace ( )

Definition at line 957 of file BibTexTest.php.

References $test.

957  {
958  $test = 'John Doe';
959  $shouldbe = array();
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));
965  }
$test
Definition: Utf8Test.php:85

◆ testFormatAuthor()

BibTexTest::testFormatAuthor ( )

Definition at line 932 of file BibTexTest.php.

References $test.

932  {
933  $test = '
934 @phdthesis{foo4,
935 author = {von Last, Jr ,First}
936 }
937  ';
938  $shouldbe = 'von Last Jr First';
939  $this->obj->content = $test;
940  /*Setting formating option and saving old state*/
941  $oldhtmlstring = $this->obj->htmlstring;
942  $this->obj->htmlstring = 'AUTHORS';
943  $oldauthorstring = $this->obj->authorstring;
944  $this->obj->authorstring = 'VON LAST JR FIRST';
945  $this->obj->parse();
946 
947  $html = $this->obj->html();
948  /*Dropping tags and trimming*/
949  $html = trim(strip_tags($html));
950  /*Resetting old state*/
951  $this->obj->htmlstring = $oldhtmlstring;
952  $this->obj->authorstring = $oldauthorstring;
953 
954  $this->assertEquals($shouldbe, $html);
955  }
$test
Definition: Utf8Test.php:85

◆ testGetStatistic()

BibTexTest::testGetStatistic ( )

Definition at line 149 of file BibTexTest.php.

150  {
151  $teststring = "@Article {art1,author = {John Doe and Jane Doe}}@Article { art2,author = {John Doe and Jane Doe}}";
152  $this->obj->content = $teststring;
153  $this->obj->parse();
154  $shouldbe = array();
155  $shouldbe['article'] = 2;
156  $this->assertEquals($shouldbe, $this->obj->getStatistic());
157  }

◆ testHasWarning()

BibTexTest::testHasWarning ( )

Definition at line 135 of file BibTexTest.php.

136  {
137  $this->obj->clearWarnings();
138  $this->assertFalse($this->obj->hasWarning());
139  }

◆ testHtmlExport()

BibTexTest::testHtmlExport ( )

Definition at line 903 of file BibTexTest.php.

References $test.

903  {
904  $test = '
905 @phdthesis{foo4,
906 title = {title},
907 author = {author},
908 journal = {journal},
909 year = {year}
910 }
911  ';
912  $shouldbe = '<p>
913 author title journal year
914 </p>
915 ';
916  $this->obj->content = $test;
917  /*Setting formating option and saving old state*/
918  $oldhtmlstring = $this->obj->htmlstring;
919  $this->obj->htmlstring = 'AUTHORS TITLE JOURNAL YEAR';
920  $oldauthorstring = $this->obj->authorstring;
921  $this->obj->authorstring = 'LAST';
922  $this->obj->parse();
923 
924  $html = $this->obj->html();
925  /*Resetting old state*/
926  $this->obj->htmlstring = $oldhtmlstring;
927  $this->obj->authorstring = $oldauthorstring;
928 
929  $this->assertEquals($shouldbe, $html);
930  }
$test
Definition: Utf8Test.php:85

◆ testLoadFileFileDoesNotExists()

BibTexTest::testLoadFileFileDoesNotExists ( )

Definition at line 62 of file BibTexTest.php.

References $ret, and PEAR\isError().

62  {
63  $ret = $this->obj->loadFile((string)time());
64  $this->assertTrue(PEAR::isError($ret));
65  }
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 56 of file BibTexTest.php.

References $ret.

56  {
57  $ret = $this->obj->loadFile("BibTexTest.php");
58  $this->content = ''; //Erasing the loaded content again because it is senseless
59  $this->assertTrue($ret);
60  }

◆ testMissingLastBraceParsing()

BibTexTest::testMissingLastBraceParsing ( )

Definition at line 703 of file BibTexTest.php.

References $test.

703  {
704  $this->obj->clearWarnings();
705  $test = '
706 @phdthesis{foo1,
707 school = {school1},
708 title = {title1},
709 author = {author1},
710 year = {year1}
711 }
712 @phdthesis{foo2,
713 school = {school2},
714 title = {title2},
715 author = {author2},
716 year = {year2}
717 
718 @phdthesis{foo3,
719 school = {school3},
720 title = {title3},
721 author = {author3},
722 year = {year3}
723 }
724 @phdthesis{foo4,
725 school = {school4},
726 title = {title4},
727 author = {author4},
728 year = {year4}
729 }
730  ';
731  $this->obj->content = $test;
732  $this->obj->setOption('validate', true);
733  $this->obj->parse();
734  $this->assertEquals($this->obj->amount(), 4);
735  }
$test
Definition: Utf8Test.php:85

◆ testMissingLastBraceParsing2()

BibTexTest::testMissingLastBraceParsing2 ( )

Definition at line 737 of file BibTexTest.php.

References $test.

737  {
738  $this->obj->clearWarnings();
739  $test = '
740 @phdthesis{foo1,
741 school = {school1},
742 title = {title1},
743 author = {author1},
744 year = {year1}
745  ';
746  $this->obj->content = $test;
747  $this->obj->setOption('validate', true);
748  $this->obj->parse();
749  $this->assertEquals($this->obj->amount(), 1);
750  }
$test
Definition: Utf8Test.php:85

◆ testMissingLastBraceWarning()

BibTexTest::testMissingLastBraceWarning ( )

Definition at line 752 of file BibTexTest.php.

References $test.

752  {
753  $this->obj->clearWarnings();
754  $test = '
755 @phdthesis{foo1,
756 school = {school1},
757 title = {title1},
758 author = {author1},
759 year = {year1}
760 }
761 @phdthesis{foo2,
762 school = {school2},
763 title = {title2},
764 author = {author2},
765 year = {year2}
766 
767 @phdthesis{foo3,
768 school = {school3},
769 title = {title3},
770 author = {author3},
771 year = {year3}
772 }
773 @phdthesis{foo4,
774 school = {school4},
775 title = {title4},
776 author = {author4},
777 year = {year4}
778 }
779  ';
780  $this->obj->content = $test;
781  $this->obj->setOption('validate', true);
782  $this->obj->parse();
783  $this->assertEquals($this->obj->warnings[0]['warning'], 'WARNING_MISSING_END_BRACE');
784  }
$test
Definition: Utf8Test.php:85

◆ testMultiParse()

BibTexTest::testMultiParse ( )

Definition at line 169 of file BibTexTest.php.

170  {
171  $teststring = "@Article { art1,
172 author = {John Doe and Jane Doe}
173 }
174 @Article { art2,
175 author = {John Doe and Jane Doe}
176 }";
177  $this->obj->content = $teststring;
178  $this->obj->parse();
179  $this->assertEquals(2,$this->obj->amount());
180  }

◆ testNewlineInAuthorField()

BibTexTest::testNewlineInAuthorField ( )

Definition at line 786 of file BibTexTest.php.

References $test.

786  {
787  $this->obj->clearWarnings();
788  $test = '
789 @phdthesis{foo1,
790 school = {school1},
791 title = {title1},
792 author = {author1 and
793 author2},
794 year = {year1}
795 }
796  ';
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);
800  $this->obj->parse();
801  $this->assertEquals($shouldbe, $this->obj->data[0]['author']);
802  }
$test
Definition: Utf8Test.php:85

◆ testNotExtractAuthors()

BibTexTest::testNotExtractAuthors ( )

Definition at line 977 of file BibTexTest.php.

References $test.

977  {
978  $this->obj->clearWarnings();
979  $test = '
980 @phdthesis{foo4,
981 author = {John Doe},
982 }
983  ';
984  $shouldbe = 'John Doe';
985  $this->obj->content = $test;
986  $this->obj->setOption('extractAuthors', false);
987  $this->obj->parse();
988  $this->assertEquals($shouldbe, $this->obj->data[0]['author']);
989  }
$test
Definition: Utf8Test.php:85

◆ testNotExtractAuthorsBibtexExport()

BibTexTest::testNotExtractAuthorsBibtexExport ( )

Definition at line 1009 of file BibTexTest.php.

References $test.

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

◆ testNotExtractAuthorsHtmlExport()

BibTexTest::testNotExtractAuthorsHtmlExport ( )

Definition at line 1031 of file BibTexTest.php.

References $test, and main().

1031  {
1032  $this->obj->clearWarnings();
1033  $test = "@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1034  $shouldbe = '<p>
1035 John Doe, "<strong></strong>", <em></em>, <br />
1036 </p>
1037 ';
1038  $this->obj->content = $test;
1039  $this->obj->setOption('extractAuthors', false);
1040  $this->obj->parse();
1041  $this->assertEquals($shouldbe, $this->obj->html());
1042  }
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:

◆ testNotExtractAuthorsRtfExport()

BibTexTest::testNotExtractAuthorsRtfExport ( )

Definition at line 1018 of file BibTexTest.php.

References $test.

1018  {
1019  $this->obj->clearWarnings();
1020  $test = "@phdthesis { foo4,\n\tauthor = {John Doe}\n}\n\n";
1021  $shouldbe = '{\rtf
1022 John Doe, "{\b }", {\i },
1023 \par
1024 }';
1025  $this->obj->content = $test;
1026  $this->obj->setOption('extractAuthors', false);
1027  $this->obj->parse();
1028  $this->assertEquals($shouldbe, $this->obj->rtf());
1029  }
$test
Definition: Utf8Test.php:85

◆ testNotRemoveCurlyBraces()

BibTexTest::testNotRemoveCurlyBraces ( )

Definition at line 804 of file BibTexTest.php.

References $test.

804  {
805  $this->obj->clearWarnings();
806  $test = '
807 @phdthesis{foo4,
808 school = {school4},
809 title = {Do {S}omething},
810 author = {author4},
811 year = {year4}
812 }
813  ';
814  $shouldbe = 'Do {S}omething';
815  $this->obj->content = $test;
816  $this->obj->setOption('removeCurlyBraces', false);
817  $this->obj->parse();
818  //print_r($this->obj->data[0]['author']);
819  $this->assertEquals($shouldbe, $this->obj->data[0]['title']);
820  }
$test
Definition: Utf8Test.php:85

◆ testParse()

BibTexTest::testParse ( )

Definition at line 182 of file BibTexTest.php.

183  {
184  $teststring = "@Article { art1,
185 title = {Titel1},
186 author = {John Doe and Jane Doe}
187 }";
188  $shouldbe = array();
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;
201  $this->obj->parse();
202  $this->assertEquals($shouldbe,$this->obj->data);
203  }

◆ testParsingComment()

BibTexTest::testParsingComment ( )

Definition at line 278 of file BibTexTest.php.

279  {
280  $teststring = "@Article { art1,
281 title = {Titel1},
282 author = {John Doe and Jane Doe}
283 }
284 Here is a comment
285 @Article { art2,
286 title = {Titel2},
287 author = {John Doe and Jane Doe}
288 }";
289  $shouldbe = array();
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;
313  $this->obj->parse();
314  $this->assertTrue($this->obj->data == $shouldbe);
315  }

◆ testRemoveCurlyBraces()

BibTexTest::testRemoveCurlyBraces ( )

Definition at line 822 of file BibTexTest.php.

References $test.

822  {
823  $this->obj->clearWarnings();
824  $test = '
825 @phdthesis{foo4,
826 school = {school4},
827 title = {Do {S}omething},
828 author = {author4},
829 year = {year4}
830 }
831  ';
832  $shouldbe = 'Do Something';
833  $this->obj->content = $test;
834  $this->obj->setOption('removeCurlyBraces', true);
835  $this->obj->parse();
836  //print_r($this->obj->data[0]['author']);
837  $this->assertEquals($shouldbe, $this->obj->data[0]['title']);
838  }
$test
Definition: Utf8Test.php:85

◆ testRemoveCurlyBraces2()

BibTexTest::testRemoveCurlyBraces2 ( )

Definition at line 840 of file BibTexTest.php.

References $test.

840  {
841  $this->obj->clearWarnings();
842  $test = '
843 @phdthesis{foo4,
844 school = {school4},
845 title = {Do {S}o{me\}th}ing},
846 author = {author4},
847 year = {year4}
848 }
849  ';
850  $shouldbe = 'Do Some\}thing';
851  $this->obj->content = $test;
852  $this->obj->setOption('removeCurlyBraces', true);
853  $this->obj->parse();
854  $this->assertEquals($shouldbe, $this->obj->data[0]['title']);
855  }
$test
Definition: Utf8Test.php:85

◆ testRemoveCurlyBracesWithoutBraces()

BibTexTest::testRemoveCurlyBracesWithoutBraces ( )

Definition at line 857 of file BibTexTest.php.

References $test.

857  {
858  $this->obj->clearWarnings();
859  $test = '
860 @phdthesis{foo4,
861 school = {school4},
862 title = {Do Something},
863 author = {author4},
864 year = {year4}
865 }
866  ';
867  $shouldbe = 'Do Something';
868  $this->obj->content = $test;
869  $this->obj->setOption('removeCurlyBraces', true);
870  $this->obj->parse();
871  $this->assertEquals($shouldbe, $this->obj->data[0]['title']);
872  }
$test
Definition: Utf8Test.php:85

◆ testRtfExport()

BibTexTest::testRtfExport ( )

Definition at line 874 of file BibTexTest.php.

References $test.

874  {
875  $test = '
876 @phdthesis{foo4,
877 title = {title},
878 author = {author},
879 journal = {journal},
880 year = {year}
881 }
882  ';
883  $shouldbe = '{\rtf
884 author title journal year
885 \par
886 }';
887  $this->obj->content = $test;
888  /*Setting formating option and saving old state*/
889  $oldrtfstring = $this->obj->rtfstring;
890  $this->obj->rtfstring = 'AUTHORS TITLE JOURNAL YEAR';
891  $oldauthorstring = $this->obj->authorstring;
892  $this->obj->authorstring = 'LAST';
893  $this->obj->parse();
894 
895  $rtf = $this->obj->rtf();
896  /*Resetting old state*/
897  $this->obj->rtfstring = $oldrtfstring;
898  $this->obj->authorstring = $oldauthorstring;
899 
900  $this->assertEquals($shouldbe, $rtf);
901  }
$test
Definition: Utf8Test.php:85

◆ testSingleParse()

BibTexTest::testSingleParse ( )

Definition at line 159 of file BibTexTest.php.

160  {
161  $teststring="@Article { ppm_jon:1991,
162 author = {John Doe and Jane Doe}
163 }";
164  $this->obj->content=$teststring;
165  $this->obj->parse();
166  $this->assertEquals(1,$this->obj->amount());
167  }

◆ testWarningAtInBraces()

BibTexTest::testWarningAtInBraces ( )

Definition at line 344 of file BibTexTest.php.

344  {
345  $teststring = "@Article { art1,
346 title = {Titel1},
347 author = {John Doe and @Jane Doe}
348 }";
349  $this->obj->content = $teststring;
350  $this->obj->parse();
351  $this->assertTrue('WARNING_AT_IN_BRACES'==$this->obj->warnings[0]['warning']);
352  }

◆ testWarningEscapedDoubleQuote()

BibTexTest::testWarningEscapedDoubleQuote ( )

Definition at line 353 of file BibTexTest.php.

353  {
354  $teststring = "@Article { art1,
355 title = {Titel1},
356 author = \"John Doe and \\\"Jane Doe\"
357 }";
358  $this->obj->content = $teststring;
359  $this->obj->parse();
360  $this->assertTrue('WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES'==$this->obj->warnings[0]['warning']);
361  }

◆ testWarningMultipleEntries()

BibTexTest::testWarningMultipleEntries ( )

Definition at line 373 of file BibTexTest.php.

373  {
374  $teststring = "@Article { art1,
375 title = {Titel1},
376 author = {John Doe and Jane Doe}
377 }
378 @Article { art2,
379 title = {Titel1},
380 author = {John Doe and Jane Doe}
381 }
382 @Article { art1,
383 title = {Titel1},
384 author = {John Doe and Jane Doe}
385 }
386 @Article { art2,
387 title = {Titel1},
388 author = {John Doe and Jane Doe}
389 }
390 @Article { art3,
391 title = {Titel1},
392 author = {John Doe and Jane Doe}
393 }";
394  $this->obj->content = $teststring;
395  $this->obj->parse();
396  $this->assertTrue('WARNING_MULTIPLE_ENTRIES'==$this->obj->warnings[0]['warning']);
397  }

◆ testWrongBraces3()

BibTexTest::testWrongBraces3 ( )

Definition at line 335 of file BibTexTest.php.

References PEAR\isError().

335  {
336  $teststring = "@Article { art1,
337 title = {Titel1},
338 author = {John {Doe and {Jane Doe}
339 }";
340  $this->obj->content = $teststring;
341  $this->assertTrue(PEAR::isError($this->obj->parse()));
342  }
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: