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

Public Member Functions

 testPlaceholderGetHtmlDescription ()
 
 testPlaceholderDescriptions ()
 

Detailed Description

Member Function Documentation

◆ testPlaceholderDescriptions()

ilCoursePlaceholderDescriptionTest::testPlaceholderDescriptions ( )

Definition at line 70 of file ilCoursePlaceholderDescriptionTest.php.

70 : void
71 {
72 $languageMock = $this->getMockBuilder(ilLanguage::class)
73 ->disableOriginalConstructor()
74 ->onlyMethods(['txt'])
75 ->getMock();
76
77 $languageMock->expects($this->exactly(3))
78 ->method('txt')
79 ->willReturn('Something translated');
80
81 $defaultPlaceholder = $this->getMockBuilder(ilDefaultPlaceholderDescription::class)
82 ->disableOriginalConstructor()
83 ->getMock();
84
85 $defaultPlaceholder->method('getPlaceholderDescriptions')
86 ->willReturn(
87 [
88 'SOMETHING' => 'SOMEWHAT',
89 'SOMETHING_ELSE' => 'ANYTHING'
90 ]
91 );
92
93 $customUserPlaceholderObject = $this->getMockBuilder(ilObjectCustomUserFieldsPlaceholderDescription::class)
94 ->disableOriginalConstructor()
95 ->getMock();
96
97 $customUserPlaceholderObject->method('getPlaceholderDescriptions')
98 ->willReturn(
99 [
100 '+SOMETHING' => 'SOMEWHAT',
101 '+SOMETHING_ELSE' => 'ANYTHING'
102 ]
103 );
104
105 $placeholderDescriptionObject = new ilCoursePlaceholderDescription(200, $defaultPlaceholder, $languageMock, null, $customUserPlaceholderObject);
106
107 $placeHolders = $placeholderDescriptionObject->getPlaceholderDescriptions();
108
109 $this->assertEquals(
110 [
111 'COURSE_TITLE' => 'Something translated',
112 'SOMETHING' => 'SOMEWHAT',
113 'SOMETHING_ELSE' => 'ANYTHING',
114 '+SOMETHING' => 'SOMEWHAT',
115 '+SOMETHING_ELSE' => 'ANYTHING',
116 'DATE_COMPLETED' => 'Something translated',
117 'DATETIME_COMPLETED' => 'Something translated'
118 ],
119 $placeHolders
120 );
121 }

◆ testPlaceholderGetHtmlDescription()

ilCoursePlaceholderDescriptionTest::testPlaceholderGetHtmlDescription ( )

Definition at line 26 of file ilCoursePlaceholderDescriptionTest.php.

26 : void
27 {
28 $languageMock = $this->getMockBuilder(ilLanguage::class)
29 ->disableOriginalConstructor()
30 ->onlyMethods(['txt', 'loadLanguageModule'])
31 ->getMock();
32
33 $templateMock = $this->getMockBuilder(ilTemplate::class)
34 ->disableOriginalConstructor()
35 ->getMock();
36
37 $templateMock->method('get')
38 ->willReturn('');
39
40 $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderDescription::class)
41 ->disableOriginalConstructor()
42 ->getMock();
43
44 $userDefinePlaceholderMock->method('createPlaceholderHtmlDescription')
45 ->willReturn('');
46
47 $userDefinePlaceholderMock->method('getPlaceholderDescriptions')
48 ->willReturn([]);
49
50 $customUserPlaceholderObject = $this->getMockBuilder(ilObjectCustomUserFieldsPlaceholderDescription::class)
51 ->disableOriginalConstructor()
52 ->getMock();
53
54 $customUserPlaceholderObject->method("getPlaceholderDescriptions")
55 ->willReturn([
56 '+SOMETHING' => 'SOMEWHAT',
57 '+SOMETHING_ELSE' => 'ANYTHING'
58 ]);
59
60 $customUserPlaceholderObject->method('createPlaceholderHtmlDescription')
61 ->willReturn('');
62
63 $placeholderDescriptionObject = new ilCoursePlaceholderDescription(200, null, $languageMock, $userDefinePlaceholderMock, $customUserPlaceholderObject);
64
65 $html = $placeholderDescriptionObject->createPlaceholderHtmlDescription($templateMock);
66
67 $this->assertSame('', $html);
68 }

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