ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateMigrationUIElementsTest Class Reference
+ Inheritance diagram for ilCertificateMigrationUIElementsTest:
+ Collaboration diagram for ilCertificateMigrationUIElementsTest:

Public Member Functions

 testTaskFailedWillDisplayedFailureMessageBox ()
 
 testTaskIsNotFailedWillDisplayConfirmMessageBox ()
 

Detailed Description

Member Function Documentation

◆ testTaskFailedWillDisplayedFailureMessageBox()

ilCertificateMigrationUIElementsTest::testTaskFailedWillDisplayedFailureMessageBox ( )

Definition at line 9 of file ilCertificateMigrationUIElementsTest.php.

10 {
11 $user = $this->getMockBuilder('ilObjUser')
12 ->disableOriginalConstructor()
13 ->getMock();
14
15 $ui = $this->getMockBuilder('\ILIAS\DI\UIServices')
16 ->disableOriginalConstructor()
17 ->setMethods(array('messageBox', 'factory', 'renderer'))
18 ->getMock();
19
20 $factory = $this->getMockBuilder('\ILIAS\UI\Factory')
21 ->disableOriginalConstructor()
22 ->getMock();
23
24 $button = $this->getMockBuilder('\ILIAS\UI\Component\Button')
25 ->disableOriginalConstructor()
26 ->setMethods(array('standard'))
27 ->getMock();
28
29 $standard = $this->getMockBuilder('\ILIAS\UI\Component\Button\Standard')
30 ->disableOriginalConstructor()
31 ->getMock();
32
33 $button->method('standard')
34 ->willReturn($standard);
35
36 $factory->method('button')
37 ->willReturn($button);
38
39 $ui->method('factory')
40 ->willReturn($factory);
41
42 $renderer = $this->getMockBuilder('\ILIAS\UI\Renderer')
43 ->disableOriginalConstructor()
44 ->getMock();
45
46 $ui->method('renderer')
47 ->willReturn($renderer);
48
49 $messageBox = $this->getMockBuilder('\ILIAS\UI\Component\MessageBox\Factory')
50 ->disableOriginalConstructor()
51 ->getMock();
52
53 $failure = $this->getMockBuilder('\ILIAS\UI\Component\MessageBox\MessageBox')
54 ->disableOriginalConstructor()
55 ->getMock();
56
57 $withButton = $this->getMockBuilder('MessageBox')
58 ->disableOriginalConstructor()
59 ->getMock();
60
61 $failure->method('withButtons')
62 ->willReturn($withButton);
63
64 $messageBox->method('failure')
65 ->willReturn($failure);
66
67 $factory->method('messageBox')
68 ->willReturn($messageBox);
69
70 $language = $this->getMockBuilder('\ilLanguage')
71 ->disableOriginalConstructor()
72 ->getMock();
73
74 $migrationUiElements = $this->getMockBuilder('\ilCertificateMigration')
75 ->disableOriginalConstructor()
76 ->getMock();
77
78 $migrationUiElements->method('isTaskFailed')
79 ->willReturn(true);
80
81 $renderer->method('render')
82 ->with($withButton)
83 ->willReturn('<alert></alert>');
84
85 $migrationUiElements = new ilCertificateMigrationUIElements(
86 $user,
87 $ui,
89 $migrationUiElements
90 );
91
92 $html = $migrationUiElements->getMigrationMessageBox('someLink');
93
94 $this->assertSame('<alert></alert>', $html);
95 }
$factory
Definition: metadata.php:43
$failure
Class ilCertificateMigrationUIElements.
$html
Definition: example_001.php:87
$user
Definition: migrateto20.php:57

References $factory, $failure, $html, $language, and $user.

◆ testTaskIsNotFailedWillDisplayConfirmMessageBox()

ilCertificateMigrationUIElementsTest::testTaskIsNotFailedWillDisplayConfirmMessageBox ( )

Definition at line 97 of file ilCertificateMigrationUIElementsTest.php.

98 {
99 $user = $this->getMockBuilder('ilObjUser')
100 ->disableOriginalConstructor()
101 ->getMock();
102
103 $ui = $this->getMockBuilder('\ILIAS\DI\UIServices')
104 ->disableOriginalConstructor()
105 ->setMethods(array('messageBox', 'factory', 'renderer'))
106 ->getMock();
107
108 $factory = $this->getMockBuilder('\ILIAS\UI\Factory')
109 ->disableOriginalConstructor()
110 ->getMock();
111
112 $button = $this->getMockBuilder('\ILIAS\UI\Component\Button')
113 ->disableOriginalConstructor()
114 ->setMethods(array('standard'))
115 ->getMock();
116
117 $standard = $this->getMockBuilder('\ILIAS\UI\Component\Button\Standard')
118 ->disableOriginalConstructor()
119 ->getMock();
120
121 $button->method('standard')
122 ->willReturn($standard);
123
124 $factory->method('button')
125 ->willReturn($button);
126
127 $ui->method('factory')
128 ->willReturn($factory);
129
130 $renderer = $this->getMockBuilder('\ILIAS\UI\Renderer')
131 ->disableOriginalConstructor()
132 ->getMock();
133
134 $ui->method('renderer')
135 ->willReturn($renderer);
136
137 $messageBox = $this->getMockBuilder('\ILIAS\UI\Component\MessageBox\Factory')
138 ->disableOriginalConstructor()
139 ->getMock();
140
141 $confirm = $this->getMockBuilder('\ILIAS\UI\Component\MessageBox\MessageBox')
142 ->disableOriginalConstructor()
143 ->getMock();
144
145 $withButton = $this->getMockBuilder('MessageBox')
146 ->disableOriginalConstructor()
147 ->getMock();
148
149 $confirm->method('withButtons')
150 ->willReturn($withButton);
151
152 $messageBox->method('confirmation')
153 ->willReturn($confirm);
154
155 $factory->method('messageBox')
156 ->willReturn($messageBox);
157
158 $language = $this->getMockBuilder('\ilLanguage')
159 ->disableOriginalConstructor()
160 ->getMock();
161
162 $migrationUiElements = $this->getMockBuilder('\ilCertificateMigration')
163 ->disableOriginalConstructor()
164 ->getMock();
165
166 $migrationUiElements->method('isTaskFailed')
167 ->willReturn(false);
168
169 $renderer->method('render')
170 ->with($withButton)
171 ->willReturn('<confirm></confirm>');
172
173 $migrationUiElements = new ilCertificateMigrationUIElements(
174 $user,
175 $ui,
176 $language,
177 $migrationUiElements
178 );
179
180 $html = $migrationUiElements->getMigrationMessageBox('someLink');
181
182 $this->assertSame('<confirm></confirm>', $html);
183 }

References $factory, $html, $language, and $user.


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