ILIAS  release_8 Revision v8.24
ilScormPlaceholderDescriptionTest Class Reference
+ Inheritance diagram for ilScormPlaceholderDescriptionTest:
+ Collaboration diagram for ilScormPlaceholderDescriptionTest:

Public Member Functions

 testPlaceholderGetHtmlDescription ()
 
 testPlaceholderDescriptions ()
 

Detailed Description

Definition at line 23 of file ilScormPlaceholderDescriptionTest.php.

Member Function Documentation

◆ testPlaceholderDescriptions()

ilScormPlaceholderDescriptionTest::testPlaceholderDescriptions ( )

Definition at line 82 of file ilScormPlaceholderDescriptionTest.php.

82 : void
83 {
84 $objectMock = $this->getMockBuilder(ilObject::class)
85 ->disableOriginalConstructor()
86 ->onlyMethods([])
87 ->getMock();
88
89 $languageMock = $this->getMockBuilder(ilLanguage::class)
90 ->disableOriginalConstructor()
91 ->onlyMethods(['txt', 'loadLanguageModule'])
92 ->getMock();
93
94 $languageMock->expects($this->exactly(21))
95 ->method('txt')
96 ->willReturn('Something translated');
97
98 $learningProgressMock = $this->getMockBuilder(ilObjectLP::class)
99 ->disableOriginalConstructor()
100 ->onlyMethods(['getCollectionInstance'])
101 ->getMock();
102
103 $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderDescription::class)
104 ->disableOriginalConstructor()
105 ->getMock();
106
107 $userDefinePlaceholderMock->method('createPlaceholderHtmlDescription')
108 ->willReturn('');
109
110 $userDefinePlaceholderMock->method('getPlaceholderDescriptions')
111 ->willReturn([]);
112
113 $placeholderDescriptionObject = new ilScormPlaceholderDescription(
114 $objectMock,
115 null,
116 $languageMock,
117 $learningProgressMock,
118 $userDefinePlaceholderMock
119 );
120
121 $placeHolders = $placeholderDescriptionObject->getPlaceholderDescriptions();
122
123 $this->assertSame(
124 [
125 'USER_LOGIN' => 'Something translated',
126 'USER_FULLNAME' => 'Something translated',
127 'USER_FIRSTNAME' => 'Something translated',
128 'USER_LASTNAME' => 'Something translated',
129 'USER_TITLE' => 'Something translated',
130 'USER_SALUTATION' => 'Something translated',
131 'USER_BIRTHDAY' => 'Something translated',
132 'USER_INSTITUTION' => 'Something translated',
133 'USER_DEPARTMENT' => 'Something translated',
134 'USER_STREET' => 'Something translated',
135 'USER_CITY' => 'Something translated',
136 'USER_ZIPCODE' => 'Something translated',
137 'USER_COUNTRY' => 'Something translated',
138 'USER_MATRICULATION' => 'Something translated',
139 'DATE' => 'Something translated',
140 'DATETIME' => 'Something translated',
141 'SCORM_TITLE' => 'Something translated',
142 'SCORM_POINTS' => 'Something translated',
143 'SCORM_POINTS_MAX' => 'Something translated',
144 'DATE_COMPLETED' => 'Something translated',
145 'DATETIME_COMPLETED' => 'Something translated'
146 ],
147 $placeHolders
148 );
149 }

◆ testPlaceholderGetHtmlDescription()

ilScormPlaceholderDescriptionTest::testPlaceholderGetHtmlDescription ( )

Definition at line 25 of file ilScormPlaceholderDescriptionTest.php.

25 : void
26 {
27 $objectMock = $this->getMockBuilder(ilObject::class)
28 ->disableOriginalConstructor()
29 ->getMock();
30
31 $languageMock = $this->getMockBuilder(ilLanguage::class)
32 ->disableOriginalConstructor()
33 ->onlyMethods(['txt', 'loadLanguageModule'])
34 ->getMock();
35
36 $templateMock = $this->getMockBuilder(ilTemplate::class)
37 ->disableOriginalConstructor()
38 ->getMock();
39
40 $templateMock->method('get')
41 ->willReturn('');
42
43 $collectionInstance = $this->getMockBuilder(ilLPCollectionOfSCOs::class)
44 ->disableOriginalConstructor()
45 ->onlyMethods(['getPossibleItems'])
46 ->getMock();
47
48 $learningProgressMock = $this->getMockBuilder(ilObjectLP::class)
49 ->disableOriginalConstructor()
50 ->onlyMethods(['getCollectionInstance'])
51 ->getMock();
52
53 $collectionInstance->method('getPossibleItems')
54 ->willReturn([0 => ['title' => 'Some SCORM Title']]);
55
56 $learningProgressMock->method('getCollectionInstance')
57 ->willReturn($collectionInstance);
58
59 $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderDescription::class)
60 ->disableOriginalConstructor()
61 ->getMock();
62
63 $userDefinePlaceholderMock->method('createPlaceholderHtmlDescription')
64 ->willReturn('');
65
66 $userDefinePlaceholderMock->method('getPlaceholderDescriptions')
67 ->willReturn([]);
68
69 $placeholderDescriptionObject = new ilScormPlaceholderDescription(
70 $objectMock,
71 null,
72 $languageMock,
73 $learningProgressMock,
74 $userDefinePlaceholderMock
75 );
76
77 $html = $placeholderDescriptionObject->createPlaceholderHtmlDescription($templateMock);
78
79 $this->assertSame('', $html);
80 }

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