ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Course\Certificate\ilCoursePlaceholderDescriptionTest Class Reference
+ Inheritance diagram for ILIAS\Course\Certificate\ilCoursePlaceholderDescriptionTest:
+ Collaboration diagram for ILIAS\Course\Certificate\ilCoursePlaceholderDescriptionTest:

Public Member Functions

 testPlaceholderGetHtmlDescription ()
 
 testPlaceholderDescriptions ()
 

Detailed Description

Member Function Documentation

◆ testPlaceholderDescriptions()

ILIAS\Course\Certificate\ilCoursePlaceholderDescriptionTest::testPlaceholderDescriptions ( )

Definition at line 84 of file ilCoursePlaceholderDescriptionTest.php.

84 : void
85 {
86 $languageMock = $this->getMockBuilder(ilLanguage::class)
87 ->disableOriginalConstructor()
88 ->onlyMethods(['txt'])
89 ->getMock();
90
91 $languageMock->expects($this->exactly(3))
92 ->method('txt')
93 ->willReturn('Something translated');
94
95 $defaultPlaceholder = $this->getMockBuilder(ilDefaultPlaceholderDescription::class)
96 ->disableOriginalConstructor()
97 ->getMock();
98
99 $defaultPlaceholder->method('getPlaceholderDescriptions')
100 ->willReturn(
101 [
102 'SOMETHING' => 'SOMEWHAT',
103 'SOMETHING_ELSE' => 'ANYTHING'
104 ]
105 );
106
107 $customUserPlaceholderObject = $this->getMockBuilder(ilObjectCustomUserFieldsPlaceholderDescription::class)
108 ->disableOriginalConstructor()
109 ->getMock();
110
111 $customUserPlaceholderObject->method('getPlaceholderDescriptions')
112 ->willReturn(
113 [
114 '+SOMETHING' => 'SOMEWHAT',
115 '+SOMETHING_ELSE' => 'ANYTHING'
116 ]
117 );
118
119 $profile = $this->getMockBuilder(Profile::class)
120 ->disableOriginalConstructor()
121 ->getMock();
122
123 $placeholderDescriptionObject = new CoursePlaceholderDescription(200, $defaultPlaceholder, $languageMock, null, $customUserPlaceholderObject, $profile);
124
125 $placeHolders = $placeholderDescriptionObject->getPlaceholderDescriptions();
126
127 $this->assertEquals(
128 [
129 'COURSE_TITLE' => 'Something translated',
130 'SOMETHING' => 'SOMEWHAT',
131 'SOMETHING_ELSE' => 'ANYTHING',
132 '+SOMETHING' => 'SOMEWHAT',
133 '+SOMETHING_ELSE' => 'ANYTHING',
134 'DATE_COMPLETED' => 'Something translated',
135 'DATETIME_COMPLETED' => 'Something translated'
136 ],
137 $placeHolders
138 );
139 }

◆ testPlaceholderGetHtmlDescription()

ILIAS\Course\Certificate\ilCoursePlaceholderDescriptionTest::testPlaceholderGetHtmlDescription ( )

Definition at line 36 of file ilCoursePlaceholderDescriptionTest.php.

36 : void
37 {
38 $languageMock = $this->getMockBuilder(ilLanguage::class)
39 ->disableOriginalConstructor()
40 ->onlyMethods(['txt', 'loadLanguageModule'])
41 ->getMock();
42
43 $templateMock = $this->getMockBuilder(ilTemplate::class)
44 ->disableOriginalConstructor()
45 ->getMock();
46
47 $templateMock->method('get')
48 ->willReturn('');
49
50 $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderDescription::class)
51 ->disableOriginalConstructor()
52 ->getMock();
53
54 $userDefinePlaceholderMock->method('createPlaceholderHtmlDescription')
55 ->willReturn('');
56
57 $userDefinePlaceholderMock->method('getPlaceholderDescriptions')
58 ->willReturn([]);
59
60 $customUserPlaceholderObject = $this->getMockBuilder(ilObjectCustomUserFieldsPlaceholderDescription::class)
61 ->disableOriginalConstructor()
62 ->getMock();
63
64 $customUserPlaceholderObject->method('getPlaceholderDescriptions')
65 ->willReturn([
66 '+SOMETHING' => 'SOMEWHAT',
67 '+SOMETHING_ELSE' => 'ANYTHING'
68 ]);
69
70 $customUserPlaceholderObject->method('createPlaceholderHtmlDescription')
71 ->willReturn('');
72
73 $profile = $this->getMockBuilder(Profile::class)
74 ->disableOriginalConstructor()
75 ->getMock();
76
77 $placeholderDescriptionObject = new CoursePlaceholderDescription(200, null, $languageMock, $userDefinePlaceholderMock, $customUserPlaceholderObject, $profile);
78
79 $html = $placeholderDescriptionObject->createPlaceholderHtmlDescription($templateMock);
80
81 $this->assertSame('', $html);
82 }

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