ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ilRisParserTest.php.

Member Function Documentation

◆ getRisContent()

ilRisParserTest::getRisContent ( )
protected

Definition at line 131 of file ilRisParserTest.php.

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

Referenced by testParseRisAsArray().

+ Here is the caller graph for this function:

◆ setUp()

ilRisParserTest::setUp ( )
protected

Definition at line 30 of file ilRisParserTest.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()

ilRisParserTest::tearDown ( )
protected

Definition at line 44 of file ilRisParserTest.php.

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

References $DIC, and $dic_backup.

◆ testParseRisAsArray()

ilRisParserTest::testParseRisAsArray ( )

Definition at line 50 of file ilRisParserTest.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 ilBiblRisFileReader(
56 $ilBiblEntryFactory,
57 $ilBiblFieldFactory,
58 $ilBiblAttributeFactory
59 );
60 $reader->setFileContent($this->getRisContent());
61 $content = $reader->parseContent();
62
63 $this->assertIsArray($content);
64 $this->assertCount(2, $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...

References getRisContent().

+ Here is the call graph for this function:

Field Documentation

◆ $dic_backup

Container ilRisParserTest::$dic_backup = null
private

Definition at line 28 of file ilRisParserTest.php.

Referenced by tearDown().


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