ILIAS  release_8 Revision v8.24
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.

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

Referenced by testParseRisAsArray().

+ Here is the caller graph for this function:

◆ setUp()

ilRisParserTest::setUp ( )
protected

Definition at line 29 of file ilRisParserTest.php.

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:32
global $DIC
Definition: feed.php:28

References $DIC.

◆ tearDown()

ilRisParserTest::tearDown ( )
protected

Definition at line 39 of file ilRisParserTest.php.

39 : void
40 {
41 global $DIC;
43 }
ILIAS DI Container $dic_backup

References $DIC, and $dic_backup.

◆ testParseRisAsArray()

ilRisParserTest::testParseRisAsArray ( )

Definition at line 45 of file ilRisParserTest.php.

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...

References getRisContent().

+ 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: