10 {
11 $objectMock = $this->getMockBuilder('ilObjUser')
12 ->disableOriginalConstructor()
13 ->setMethods(
14 array(
15 'getLogin',
16 'getFullname',
17 'getFirstname',
18 'getLastname',
19 'getUTitle',
20 'getGender',
21 'getBirthday',
22 'getInstitution',
23 'getDepartment',
24 'getStreet',
25 'getCity',
26 'getZipcode',
27 'getCountry',
28 'getMatriculation'
29 )
30 )
31 ->getMock();
32
33 $objectMock->expects($this->once())
34 ->method('getLogin')
35 ->willReturn('a_login');
36
37 $objectMock->expects($this->once())
38 ->method('getFullname')
39 ->willReturn('Niels Theen');
40
41 $objectMock->expects($this->once())
42 ->method('getFirstname')
43 ->willReturn('Niels');
44
45 $objectMock->expects($this->once())
46 ->method('getLastname')
47 ->willReturn('Theen');
48
49 $objectMock->expects($this->once())
50 ->method('getUTitle')
51 ->willReturn('');
52
53 $objectMock->expects($this->once())
54 ->method('getGender')
55 ->willReturn('m');
56
57 $objectMock->expects($this->once())
58 ->method('getBirthday')
59 ->willReturn('2018-10-10');
60
61 $objectMock->expects($this->once())
62 ->method('getInstitution')
63 ->willReturn('');
64
65 $objectMock->expects($this->once())
66 ->method('getDepartment')
67 ->willReturn('');
68
69 $objectMock->expects($this->once())
70 ->method('getStreet')
71 ->willReturn('');
72
73 $objectMock->expects($this->once())
74 ->method('getCity')
75 ->willReturn('');
76
77 $objectMock->expects($this->once())
78 ->method('getZipcode')
79 ->willReturn('');
80
81 $objectMock->expects($this->once())
82 ->method('getCountry')
83 ->willReturn('');
84
85 $objectMock->expects($this->once())
86 ->method('getMatriculation')
87 ->willReturn('');
88
89 $objectHelper = $this->getMockBuilder('ilCertificateObjectHelper')
90 ->getMock();
91
92 $objectHelper->expects($this->once())
93 ->method('getInstanceByObjId')
94 ->with(100)
95 ->willReturn($objectMock);
96
97 $dateHelper = $this->getMockBuilder('ilCertificateDateHelper')
98 ->getMock();
99
100 $dateHelper->expects($this->exactly(2))
101 ->method('formatDate')
102 ->willReturn('2018-09-10');
103
104 $dateHelper->expects($this->once())
105 ->method('formatDateTime')
106 ->willReturn('2018-09-10 12:01:33');
107
108 $language = $this->getMockBuilder('ilLanguage')
109 ->disableOriginalConstructor()
110 ->getMock();
111
112 $language->method('txt')
113 ->willReturn('Something');
114
115 $utilHelper = $this->getMockBuilder('ilCertificateUtilHelper')
116 ->getMock();
117
118 $utilHelper->method('prepareFormOutput')
119 ->willReturnCallback(function ($input) {
120 return $input;
121 });
122
123 $userDefinePlaceholderMock = $this->getMockBuilder('ilUserDefinedFieldsPlaceholderValues')
124 ->disableOriginalConstructor()
125 ->getMock();
126
127 $userDefinePlaceholderMock->method('getPlaceholderValues')
128 ->willReturn(array());
129
130 $userDefinePlaceholderMock->method('getPlaceholderValuesForPreview')
131 ->willReturn(array());
132
134 $objectHelper,
135 $dateHelper,
136 1,
137 $language,
138 $utilHelper,
139 $userDefinePlaceholderMock,
140 1
141 );
142
143 $result = $placeHolderObject->getPlaceholderValues(100, 200);
144
145 $this->assertEquals(
146 array(
147 'USER_LOGIN' => 'a_login',
148 'USER_FULLNAME' => 'Niels Theen',
149 'USER_FIRSTNAME' => 'Niels',
150 'USER_LASTNAME' => 'Theen',
151 'USER_TITLE' => '',
152 'USER_SALUTATION' => 'Something',
153 'USER_BIRTHDAY' => '2018-09-10',
154 'USER_INSTITUTION' => '',
155 'USER_DEPARTMENT' => '',
156 'USER_STREET' => '',
157 'USER_CITY' => '',
158 'USER_ZIPCODE' => '',
159 'USER_COUNTRY' => '',
160 'USER_MATRICULATION' => '',
161 'DATE' => '',
162 'DATETIME' => '',
163 'DATE_COMPLETED' => '',
164 'DATETIME_COMPLETED' => '',
165 'DATE' => '2018-09-10',
166 'DATETIME' => '2018-09-10 12:01:33'
167 ),
169 );
170 }
Collection of basic placeholder values that can be used.