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