ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBibtechParserTest Class Reference
+ Inheritance diagram for ilBibtechParserTest:
+ Collaboration diagram for ilBibtechParserTest:

Public Member Functions

 testParseBibtechAsArray ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 getBibtechContent ()
 

Private Attributes

Container $dic_backup = null
 

Detailed Description

Definition at line 26 of file ilBibtechParserTest.php.

Member Function Documentation

◆ getBibtechContent()

ilBibtechParserTest::getBibtechContent ( )
protected

Definition at line 134 of file ilBibtechParserTest.php.

134 : string
135 {
136 return '@book {
137author = {Süß, Henrik http://www.testlink.ch},
138title = {Last Minute Histologie: [Fit fürs Examen in 2 Tagen!]},
139address = {München},
140year = {2012},
141publisher = {Elsevier, Urban & Fischer},
142keywords = {Histologie. Lehrbuch},
143pages = {XIII, 103 S.},
144edition = {1. Aufl.},
145ISBN = {978-3-437-43015-2},
146ISBN = {3-437-43015-7},
147}
148@journal {
149author = {Voll, Markus http://de.wikipedia.org/wiki/a-z},
150editor = {Voll, Markus},
151title = {Atlas of neuroanatomy for communication science and disorders: based on the work of Michael Schuenke, Erik Schulte, Udo Schumacher},
152address = {New York},
153year = {2012},
154publisher = {Thieme},
155keywords = {Sprachstörung. Zentralnervensystem. Neuroanatomie. Neuropathologie. Atlas},
156pages = {IX, 176 S.},
157ISBN = {978-1-60406-649-4},
158}';
159 }

Referenced by testParseBibtechAsArray().

+ Here is the caller graph for this function:

◆ setUp()

ilBibtechParserTest::setUp ( )
protected

Definition at line 30 of file ilBibtechParserTest.php.

30 : void
31 {
32 global $DIC;
33 $this->dic_backup = is_object($DIC) ? clone $DIC : $DIC;
34
35 $DIC = new Container();
36 $DIC['resource_storage'] = $this->createMock(Services::class);
37 $DIC['ilDB'] = $this->createMock(ilDBInterface::class);
38 $DIC['refinery'] = new Factory(
39 new ILIAS\Data\Factory(),
40 $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()
41 );
42 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26

References $DIC.

◆ tearDown()

ilBibtechParserTest::tearDown ( )
protected

Definition at line 44 of file ilBibtechParserTest.php.

44 : void
45 {
46 global $DIC;
48 }

References $DIC, and $dic_backup.

◆ testParseBibtechAsArray()

ilBibtechParserTest::testParseBibtechAsArray ( )

Definition at line 50 of file ilBibtechParserTest.php.

50 : void
51 {
52 $ilBiblEntryFactory = $this->createMock(ilBiblEntryFactoryInterface::class);
53 $ilBiblFieldFactory = $this->createMock(ilBiblFieldFactoryInterface::class);
54 $ilBiblAttributeFactory = $this->createMock(ilBiblAttributeFactoryInterface::class);
55 $reader = new ilBiblTexFileReader(
56 $ilBiblEntryFactory,
57 $ilBiblFieldFactory,
58 $ilBiblAttributeFactory
59 );
60 $reader->setFileContent($this->getBibtechContent());
61 $content = $reader->parseContent();
62 $this->assertIsArray($content);
63 $this->assertCount(2, $content);
64
65 // First item
66 $first_item = $content[0];
67 $this->assertEquals('book', $first_item['entryType']);
68 $this->assertEquals('Süß, Henrik http://www.testlink.ch', $first_item['author']);
69 $this->assertEquals('Last Minute Histologie: [Fit fürs Examen in 2 Tagen!]', $first_item['title']);
70 $this->assertEquals('München', $first_item['address']);
71 $this->assertEquals('2012', $first_item['year']);
72 $this->assertEquals('Elsevier, Urban & Fischer', $first_item['publisher']);
73 $this->assertEquals('Histologie. Lehrbuch', $first_item['keywords']);
74 $this->assertEquals('XIII, 103 S.', $first_item['pages']);
75 $this->assertEquals('1. Aufl.', $first_item['edition']);
76 $this->assertEquals('3-437-43015-7', $first_item['isbn']);
77
78 // Second item
79 $second_item = $content[1];
80 $this->assertEquals('journal', $second_item['entryType']);
81 $this->assertEquals('Voll, Markus http://de.wikipedia.org/wiki/a-z', $second_item['author']);
82 $this->assertEquals(
83 'Atlas of neuroanatomy for communication science and disorders: based on the work of Michael Schuenke, Erik Schulte, Udo Schumacher',
84 $second_item['title']
85 );
86 $this->assertEquals('New York', $second_item['address']);
87 $this->assertEquals('2012', $second_item['year']);
88 $this->assertEquals('Thieme', $second_item['publisher']);
89 $this->assertEquals(
90 'Sprachstörung. Zentralnervensystem. Neuroanatomie. Neuropathologie. Atlas',
91 $second_item['keywords']
92 );
93 $this->assertEquals('IX, 176 S.', $second_item['pages']);
94 $this->assertEquals('978-1-60406-649-4', $second_item['isbn']);
95 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References getBibtechContent().

+ Here is the call graph for this function:

Field Documentation

◆ $dic_backup

Container ilBibtechParserTest::$dic_backup = null
private

Definition at line 28 of file ilBibtechParserTest.php.

Referenced by tearDown().


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