ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 52 of file ilCoursePlaceholderDescriptionTest.php.

53  {
54  $languageMock = $this->getMockBuilder('ilLanguage')
55  ->disableOriginalConstructor()
56  ->onlyMethods(['txt'])
57  ->getMock();
58 
59  $languageMock->expects($this->exactly(3))
60  ->method('txt')
61  ->willReturn('Something translated');
62 
63  $defaultPlaceholder = $this->getMockBuilder('ilDefaultPlaceholderDescription')
64  ->disableOriginalConstructor()
65  ->getMock();
66 
67  $defaultPlaceholder->method('getPlaceholderDescriptions')
68  ->willReturn(
69  array(
70  'SOMETHING' => 'SOMEWHAT',
71  'SOMETHING_ELSE' => 'ANYTHING'
72  )
73  );
74 
75  $customUserPlaceholderObject = $this->getMockBuilder('ilObjectCustomUserFieldsPlaceholderDescription')
76  ->disableOriginalConstructor()
77  ->getMock();
78 
79  $customUserPlaceholderObject->method('getPlaceholderDescriptions')
80  ->willReturn(
81  array(
82  '+SOMETHING' => 'SOMEWHAT',
83  '+SOMETHING_ELSE' => 'ANYTHING'
84  )
85  );
86 
87  $placeholderDescriptionObject = new ilCoursePlaceholderDescription(200, $defaultPlaceholder, $languageMock, null, $customUserPlaceholderObject);
88 
89  $placeHolders = $placeholderDescriptionObject->getPlaceholderDescriptions();
90 
91  $this->assertEquals(
92  array(
93  'COURSE_TITLE' => 'Something translated',
94  'SOMETHING' => 'SOMEWHAT',
95  'SOMETHING_ELSE' => 'ANYTHING',
96  '+SOMETHING' => 'SOMEWHAT',
97  '+SOMETHING_ELSE' => 'ANYTHING',
98  'DATE_COMPLETED' => 'Something translated',
99  'DATETIME_COMPLETED' => 'Something translated'
100  ),
101  $placeHolders
102  );
103  }

◆ testPlaceholderGetHtmlDescription()

ilCoursePlaceholderDescriptionTest::testPlaceholderGetHtmlDescription ( )

Definition at line 8 of file ilCoursePlaceholderDescriptionTest.php.

9  {
10  $languageMock = $this->getMockBuilder('ilLanguage')
11  ->disableOriginalConstructor()
12  ->onlyMethods(['txt', 'loadLanguageModule'])
13  ->getMock();
14 
15  $templateMock = $this->getMockBuilder('ilTemplate')
16  ->disableOriginalConstructor()
17  ->getMock();
18 
19  $templateMock->method('get')
20  ->willReturn('');
21 
22  $userDefinePlaceholderMock = $this->getMockBuilder('ilUserDefinedFieldsPlaceholderDescription')
23  ->disableOriginalConstructor()
24  ->getMock();
25 
26  $userDefinePlaceholderMock->method('createPlaceholderHtmlDescription')
27  ->willReturn('');
28 
29  $userDefinePlaceholderMock->method('getPlaceholderDescriptions')
30  ->willReturn([]);
31 
32  $customUserPlaceholderObject = $this->getMockBuilder("ilObjectCustomUserFieldsPlaceholderDescription")
33  ->disableOriginalConstructor()
34  ->getMock();
35 
36  $customUserPlaceholderObject->method("getPlaceholderDescriptions")
37  ->willReturn(array(
38  '+SOMETHING' => 'SOMEWHAT',
39  '+SOMETHING_ELSE' => 'ANYTHING'
40  ));
41 
42  $customUserPlaceholderObject->method('createPlaceholderHtmlDescription')
43  ->willReturn('');
44 
45  $placeholderDescriptionObject = new ilCoursePlaceholderDescription(200, null, $languageMock, $userDefinePlaceholderMock, $customUserPlaceholderObject);
46 
47  $html = $placeholderDescriptionObject->createPlaceholderHtmlDescription($templateMock);
48 
49  $this->assertEquals('', $html);
50  }

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