ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestPlaceholderDescriptionTest Class Reference
+ Inheritance diagram for ilTestPlaceholderDescriptionTest:
+ Collaboration diagram for ilTestPlaceholderDescriptionTest:

Public Member Functions

 testPlaceholderGetHtmlDescription ()
 
 testPlaceholderDescriptions ()
 

Detailed Description

Member Function Documentation

◆ testPlaceholderDescriptions()

ilTestPlaceholderDescriptionTest::testPlaceholderDescriptions ( )

Definition at line 57 of file ilTestPlaceholderDescriptionTest.php.

57  : void
58  {
59  $languageMock = $this->getMockBuilder(ilLanguage::class)
60  ->disableOriginalConstructor()
61  ->onlyMethods(['txt', 'loadLanguageModule'])
62  ->getMock();
63 
64  $languageMock->expects($this->exactly(25))
65  ->method('txt')
66  ->willReturn('Something translated');
67 
68  $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderDescription::class)
69  ->disableOriginalConstructor()
70  ->getMock();
71 
72  $userDefinePlaceholderMock->method('createPlaceholderHtmlDescription')
73  ->willReturn("Something");
74 
75  $userDefinePlaceholderMock->method('getPlaceholderDescriptions')
76  ->willReturn([]);
77 
78  $placeholderDescriptionObject = new ilTestPlaceholderDescription(null, $languageMock, $userDefinePlaceholderMock);
79 
80  $placeHolders = $placeholderDescriptionObject->getPlaceholderDescriptions();
81 
82  $this->assertSame(
83  [
84  'USER_LOGIN' => 'Something translated',
85  'USER_FULLNAME' => 'Something translated',
86  'USER_FIRSTNAME' => 'Something translated',
87  'USER_LASTNAME' => 'Something translated',
88  'USER_TITLE' => 'Something translated',
89  'USER_SALUTATION' => 'Something translated',
90  'USER_BIRTHDAY' => 'Something translated',
91  'USER_INSTITUTION' => 'Something translated',
92  'USER_DEPARTMENT' => 'Something translated',
93  'USER_STREET' => 'Something translated',
94  'USER_CITY' => 'Something translated',
95  'USER_ZIPCODE' => 'Something translated',
96  'USER_COUNTRY' => 'Something translated',
97  'USER_MATRICULATION' => 'Something translated',
98  'DATE' => 'Something translated',
99  'DATETIME' => 'Something translated',
100  'RESULT_PASSED' => 'Something translated',
101  'RESULT_POINTS' => 'Something translated',
102  'RESULT_PERCENT' => 'Something translated',
103  'MAX_POINTS' => 'Something translated',
104  'RESULT_MARK_SHORT' => 'Something translated',
105  'RESULT_MARK_LONG' => 'Something translated',
106  'TEST_TITLE' => 'Something translated',
107  'DATE_COMPLETED' => 'Something translated',
108  'DATETIME_COMPLETED' => 'Something translated'
109  ],
110  $placeHolders
111  );
112  }

◆ testPlaceholderGetHtmlDescription()

ilTestPlaceholderDescriptionTest::testPlaceholderGetHtmlDescription ( )

Definition at line 26 of file ilTestPlaceholderDescriptionTest.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("Something");
46 
47  $userDefinePlaceholderMock->method('getPlaceholderDescriptions')
48  ->willReturn([]);
49 
50  $placeholderDescriptionObject = new ilTestPlaceholderDescription(null, $languageMock, $userDefinePlaceholderMock);
51 
52  $html = $placeholderDescriptionObject->createPlaceholderHtmlDescription($templateMock);
53 
54  $this->assertSame('', $html);
55  }

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