ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilExercisePlaceholderDescriptionTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
7 {
9  {
10  $languageMock = $this->getMockBuilder('ilLanguage')
11  ->disableOriginalConstructor()
12  ->setMethods(array('txt'))
13  ->getMock();
14 
15  $templateMock = $this->getMockBuilder('ilTemplate')
16  ->disableOriginalConstructor()
17  ->getMock();
18 
19  $userDefinePlaceholderMock = $this->getMockBuilder('ilUserDefinedFieldsPlaceholderDescription')
20  ->disableOriginalConstructor()
21  ->getMock();
22 
23  $userDefinePlaceholderMock->method('createPlaceholderHtmlDescription')
24  ->willReturn(array());
25 
26  $userDefinePlaceholderMock->method('getPlaceholderDescriptions')
27  ->willReturn(array());
28 
29  $templateMock->method('get')
30  ->willReturn('');
31 
32  $placeholderDescriptionObject = new ilExercisePlaceholderDescription(null, $languageMock, $userDefinePlaceholderMock);
33 
34  $html = $placeholderDescriptionObject->createPlaceholderHtmlDescription($templateMock);
35 
36  $this->assertEquals('', $html);
37  }
38 
39  public function testPlaceholderDescriptions()
40  {
41  $languageMock = $this->getMockBuilder('ilLanguage')
42  ->disableOriginalConstructor()
43  ->setMethods(array('txt'))
44  ->getMock();
45 
46  $languageMock->expects($this->exactly(21))
47  ->method('txt')
48  ->willReturn('Something translated');
49 
50  $userDefinePlaceholderMock = $this->getMockBuilder('ilUserDefinedFieldsPlaceholderDescription')
51  ->disableOriginalConstructor()
52  ->getMock();
53 
54  $userDefinePlaceholderMock->method('createPlaceholderHtmlDescription')
55  ->willReturn(array());
56 
57  $userDefinePlaceholderMock->method('getPlaceholderDescriptions')
58  ->willReturn(array());
59 
60  $placeholderDescriptionObject = new ilExercisePlaceholderDescription(null, $languageMock, $userDefinePlaceholderMock);
61 
62  $placeHolders = $placeholderDescriptionObject->getPlaceholderDescriptions();
63 
64  $this->assertEquals(
65  array(
66  'USER_LOGIN' => 'Something translated',
67  'USER_FULLNAME' => 'Something translated',
68  'USER_FIRSTNAME' => 'Something translated',
69  'USER_LASTNAME' => 'Something translated',
70  'USER_TITLE' => 'Something translated',
71  'USER_SALUTATION' => 'Something translated',
72  'USER_BIRTHDAY' => 'Something translated',
73  'USER_INSTITUTION' => 'Something translated',
74  'USER_DEPARTMENT' => 'Something translated',
75  'USER_STREET' => 'Something translated',
76  'USER_CITY' => 'Something translated',
77  'USER_ZIPCODE' => 'Something translated',
78  'USER_COUNTRY' => 'Something translated',
79  'USER_MATRICULATION' => 'Something translated',
80  'DATE' => 'Something translated',
81  'DATETIME' => 'Something translated',
82  'RESULT_PASSED' => 'Something translated',
83  'RESULT_MARK' => 'Something translated',
84  'EXERCISE_TITLE' => 'Something translated',
85  'DATE_COMPLETED' => 'Something translated',
86  'DATETIME_COMPLETED' => 'Something translated'
87  ),
88  $placeHolders
89  );
90  }
91 }
$html
Definition: example_001.php:87