ILIAS  release_8 Revision v8.23
ilRisParserTest Class Reference
+ Inheritance diagram for ilRisParserTest:
+ Collaboration diagram for ilRisParserTest:

Public Member Functions

 testParseRisAsArray ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 getRisContent ()
 

Private Attributes

ILIAS DI Container $dic_backup = null
 

Detailed Description

Definition at line 25 of file ilRisParserTest.php.

Member Function Documentation

◆ getRisContent()

ilRisParserTest::getRisContent ( )
protected

Definition at line 124 of file ilRisParserTest.php.

Referenced by testParseRisAsArray().

124  : string
125  {
126  return 'TY - BOOK
127 A2 - Schrode, Paula
128 A2 - Simon, Udo Gerald
129 T1 - Die Sunna leben
130 T2 - zur Dynamik islamischer Religionspraxis in Deutschland
131 CY - Würzburg
132 Y1 - 2012
133 PB - Egon
134 KW - Deutschland
135 KW - Islam
136 KW - Religionsausübung
137 KW - Kongress
138 EP - 250 S.
139 SN - 978-3-89913-722-4
140 U1 - Wilhelmstraße
141 ER -
142 TY - JOURNAL
143 A2 - Gienow-Hecht, Jessica C. E.
144 T1 - Searching for a cultural diplomacy
145 CY - New York [u.a.]
146 Y1 - 2010
147 PB - Berghahn
148 KW - Sowjetunion
149 KW - Mitteleuropa
150 KW - Naher Osten
151 KW - Japan
152 KW - Kulturbeziehungen
153 KW - Diplomatie
154 KW - Geschichte 1900-2000
155 KW - Aufsatzsammlung
156 EP - XII, 265 S.
157 SN - 978-1-84545-746-4
158 U1 - Wilhelmstraße
159 ER - ';
160  }
+ Here is the caller graph for this function:

◆ setUp()

ilRisParserTest::setUp ( )
protected

Definition at line 29 of file ilRisParserTest.php.

References $DIC.

29  : void
30  {
31  global $DIC;
32  $this->dic_backup = is_object($DIC) ? clone $DIC : $DIC;
33 
34  $DIC = new Container();
35  $DIC['resource_storage'] = $this->createMock(Services::class);
36  $DIC['ilDB'] = $this->createMock(ilDBInterface::class);
37  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28

◆ tearDown()

ilRisParserTest::tearDown ( )
protected

Definition at line 39 of file ilRisParserTest.php.

References $DIC, and $dic_backup.

39  : void
40  {
41  global $DIC;
42  $DIC = $this->dic_backup;
43  }
ILIAS DI Container $dic_backup
global $DIC
Definition: feed.php:28

◆ testParseRisAsArray()

ilRisParserTest::testParseRisAsArray ( )

Definition at line 45 of file ilRisParserTest.php.

References getRisContent().

45  : void
46  {
47  $ilBiblEntryFactory = $this->createMock(ilBiblEntryFactoryInterface::class);
48  $ilBiblFieldFactory = $this->createMock(ilBiblFieldFactoryInterface::class);
49  $ilBiblAttributeFactory = $this->createMock(ilBiblAttributeFactoryInterface::class);
50  $reader = new ilBiblRisFileReader(
51  $ilBiblEntryFactory,
52  $ilBiblFieldFactory,
53  $ilBiblAttributeFactory
54  );
55  $reader->setFileContent($this->getRisContent());
56  $content = $reader->parseContent();
57 
58  $this->assertIsArray($content);
59  $this->assertEquals(2, count($content));
60 
61  // First item
62  $first_item = $content[0];
63 
64  $this->assertEquals('BOOK', $first_item['TY']);
65  $this->assertEquals('Schrode, Paula, Simon, Udo Gerald', $first_item['A2']);
66  $this->assertEquals('Die Sunna leben', $first_item['T1']);
67  $this->assertEquals('zur Dynamik islamischer Religionspraxis in Deutschland', $first_item['T2']);
68  $this->assertEquals('Würzburg', $first_item['CY']);
69  $this->assertEquals('2012', $first_item['Y1']);
70  $this->assertEquals('Egon', $first_item['PB']);
71  $this->assertEquals('Deutschland, Islam, Religionsausübung, Kongress', $first_item['KW']);
72  $this->assertEquals('250 S.', $first_item['EP']);
73  $this->assertEquals('978-3-89913-722-4', $first_item['SN']);
74 
75  // Second item
76  $second_item = $content[1];
77 
78  $this->assertEquals('JOURNAL', $second_item['TY']);
79  $this->assertEquals('Gienow-Hecht, Jessica C. E.', $second_item['A2']);
80  $this->assertEquals('Searching for a cultural diplomacy', $second_item['T1']);
81  $this->assertEquals('New York [u.a.]', $second_item['CY']);
82  $this->assertEquals('2010', $second_item['Y1']);
83  $this->assertEquals('Berghahn', $second_item['PB']);
84  $this->assertEquals('Sowjetunion, Mitteleuropa, Naher Osten, Japan, Kulturbeziehungen, Diplomatie, Geschichte 1900-2000, Aufsatzsammlung', $second_item['KW']);
85  $this->assertEquals('XII, 265 S.', $second_item['EP']);
86  $this->assertEquals('978-1-84545-746-4', $second_item['SN']);
87  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Field Documentation

◆ $dic_backup

ILIAS DI Container ilRisParserTest::$dic_backup = null
private

Definition at line 27 of file ilRisParserTest.php.

Referenced by tearDown().


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