ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilRisParserTest Class Reference
+ Inheritance diagram for ilRisParserTest:
+ Collaboration diagram for ilRisParserTest:

Public Member Functions

 testParseRisAsArray ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 getRisContent ()
 

Private Attributes

Container $dic_backup = null
 

Detailed Description

Definition at line 26 of file ilRisParserTestTBD.php.

Member Function Documentation

◆ getRisContent()

ilRisParserTest::getRisContent ( )
protected

Definition at line 129 of file ilRisParserTestTBD.php.

Referenced by testParseRisAsArray().

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

◆ setUp()

ilRisParserTest::setUp ( )
protected

Definition at line 30 of file ilRisParserTestTBD.php.

References $DIC.

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  }
Interface Observer Contains several chained tasks and infos about them.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
global $DIC
Definition: shib_login.php:22

◆ tearDown()

ilRisParserTest::tearDown ( )
protected

Definition at line 44 of file ilRisParserTestTBD.php.

References $DIC, and $dic_backup.

44  : void
45  {
46  global $DIC;
47  $DIC = $this->dic_backup;
48  }
global $DIC
Definition: shib_login.php:22

◆ testParseRisAsArray()

ilRisParserTest::testParseRisAsArray ( )

Definition at line 50 of file ilRisParserTestTBD.php.

References getRisContent().

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

Container ilRisParserTest::$dic_backup = null
private

Definition at line 28 of file ilRisParserTestTBD.php.

Referenced by tearDown().


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