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

Public Member Functions

 testGetTaskInformations ()
 
 testGetTaskInformationsWithNoInformationStored ()
 
 testProgressedItemsAsPercent ()
 
 testIsTaskStarted ()
 
 testIsTaskRunning ()
 
 testIsTaskFailed ()
 
 testIsTaskFinished ()
 

Detailed Description

Definition at line 3 of file ilCertificateMigrationTest.php.

Member Function Documentation

◆ testGetTaskInformations()

ilCertificateMigrationTest::testGetTaskInformations ( )

Definition at line 5 of file ilCertificateMigrationTest.php.

References $result.

6  {
7  $database = $this->getMockBuilder('ilDBInterface')
8  ->disableOriginalConstructor()
9  ->getMock();
10 
11  $statement = $this->getMockBuilder('ilDBStatement')
12  ->disableOriginalConstructor()
13  ->getMock();
14 
15  $statement
16  ->expects($this->atLeastOnce())
17  ->method('numRows')
18  ->willReturn(1);
19 
20  $database
21  ->expects($this->atLeastOnce())
22  ->method('queryF')
23  ->willReturn($statement);
24 
25  $database
26  ->expects($this->atLeastOnce())
27  ->method('fetchAssoc')
28  ->willReturn(array(
29  'id' => 100,
30  'usr_id' => 200,
31  'lock' => false,
32  'found_items' => 4,
33  'processed_items' => 3,
34  'migrated_items' => 5,
35  'progress' => 50,
36  'state' => 10,
37  'started_ts' => 123456789,
38  'finished_ts' => 987654321
39  ));
40 
41  $migration = new ilCertificateMigration(100, $database);
42 
43  $result = $migration->getTaskInformations();
44 
45  $this->assertEquals(array(
46  'id' => 100,
47  'usr_id' => 200,
48  'lock' => false,
49  'found_items' => 4,
50  'processed_items' => 3,
51  'migrated_items' => 5,
52  'progress' => 50,
53  'state' => 10,
54  'started_ts' => 123456789,
55  'finished_ts' => 987654321
56  ), $result);
57  }
$result
Class ilCertificateMigration.

◆ testGetTaskInformationsWithNoInformationStored()

ilCertificateMigrationTest::testGetTaskInformationsWithNoInformationStored ( )

Definition at line 59 of file ilCertificateMigrationTest.php.

References $result.

60  {
61  $database = $this->getMockBuilder('ilDBInterface')
62  ->disableOriginalConstructor()
63  ->getMock();
64 
65  $statement = $this->getMockBuilder('ilDBStatement')
66  ->disableOriginalConstructor()
67  ->getMock();
68 
69  $statement
70  ->expects($this->atLeastOnce())
71  ->method('numRows')
72  ->willReturn(1);
73 
74  $database
75  ->expects($this->atLeastOnce())
76  ->method('queryF')
77  ->willReturn($statement);
78 
79  $database
80  ->expects($this->atLeastOnce())
81  ->method('fetchAssoc')
82  ->willReturn(array(
83  'id' => 100,
84  'usr_id' => 200,
85  'lock' => false,
86  'found_items' => 4,
87  'processed_items' => 3,
88  'migrated_items' => 5,
89  'progress' => 50,
90  'state' => 10,
91  'started_ts' => 123456789,
92  'finished_ts' => 987654321
93  ));
94 
95  $migration = new ilCertificateMigration(100, $database);
96 
97  $result = $migration->getTaskInformationObject();
98 
99  $this->assertEquals(100, $result->getId());
100  }
$result
Class ilCertificateMigration.

◆ testIsTaskFailed()

ilCertificateMigrationTest::testIsTaskFailed ( )

Definition at line 231 of file ilCertificateMigrationTest.php.

References $result.

232  {
233  $database = $this->getMockBuilder('ilDBInterface')
234  ->disableOriginalConstructor()
235  ->getMock();
236 
237  $statement = $this->getMockBuilder('ilDBStatement')
238  ->disableOriginalConstructor()
239  ->getMock();
240 
241  $statement
242  ->expects($this->atLeastOnce())
243  ->method('numRows')
244  ->willReturn(1);
245 
246  $database
247  ->expects($this->atLeastOnce())
248  ->method('queryF')
249  ->willReturn($statement);
250 
251  $database
252  ->expects($this->atLeastOnce())
253  ->method('fetchAssoc')
254  ->willReturn(array(
255  'id' => 100,
256  'usr_id' => 200,
257  'lock' => true,
258  'found_items' => 4,
259  'processed_items' => 3,
260  'migrated_items' => 5,
261  'progress' => 50,
262  'state' => 'failed',
263  'started_ts' => 123456789,
264  'finished_ts' => 987654321
265  ));
266 
267  $migration = new ilCertificateMigration(100, $database);
268 
269  $result = $migration->isTaskFailed();
270 
271  $this->assertTrue($result);
272  }
$result
Class ilCertificateMigration.

◆ testIsTaskFinished()

ilCertificateMigrationTest::testIsTaskFinished ( )

Definition at line 274 of file ilCertificateMigrationTest.php.

References $result.

275  {
276  $database = $this->getMockBuilder('ilDBInterface')
277  ->disableOriginalConstructor()
278  ->getMock();
279 
280  $statement = $this->getMockBuilder('ilDBStatement')
281  ->disableOriginalConstructor()
282  ->getMock();
283 
284  $statement
285  ->expects($this->atLeastOnce())
286  ->method('numRows')
287  ->willReturn(1);
288 
289  $database
290  ->expects($this->atLeastOnce())
291  ->method('queryF')
292  ->willReturn($statement);
293 
294  $database
295  ->expects($this->atLeastOnce())
296  ->method('fetchAssoc')
297  ->willReturn(array(
298  'id' => 100,
299  'usr_id' => 200,
300  'lock' => true,
301  'found_items' => 4,
302  'processed_items' => 3,
303  'migrated_items' => 5,
304  'progress' => 50,
305  'state' => 'finished',
306  'started_ts' => 123456789,
307  'finished_ts' => 987654321
308  ));
309 
310  $migration = new ilCertificateMigration(100, $database);
311 
312  $result = $migration->isTaskFinished();
313 
314  $this->assertTrue($result);
315  }
$result
Class ilCertificateMigration.

◆ testIsTaskRunning()

ilCertificateMigrationTest::testIsTaskRunning ( )

Definition at line 188 of file ilCertificateMigrationTest.php.

References $result.

189  {
190  $database = $this->getMockBuilder('ilDBInterface')
191  ->disableOriginalConstructor()
192  ->getMock();
193 
194  $statement = $this->getMockBuilder('ilDBStatement')
195  ->disableOriginalConstructor()
196  ->getMock();
197 
198  $statement
199  ->expects($this->atLeastOnce())
200  ->method('numRows')
201  ->willReturn(1);
202 
203  $database
204  ->expects($this->atLeastOnce())
205  ->method('queryF')
206  ->willReturn($statement);
207 
208  $database
209  ->expects($this->atLeastOnce())
210  ->method('fetchAssoc')
211  ->willReturn(array(
212  'id' => 100,
213  'usr_id' => 200,
214  'lock' => true,
215  'found_items' => 4,
216  'processed_items' => 3,
217  'migrated_items' => 5,
218  'progress' => 50,
219  'state' => 'running',
220  'started_ts' => 123456789,
221  'finished_ts' => 987654321
222  ));
223 
224  $migration = new ilCertificateMigration(100, $database);
225 
226  $result = $migration->isTaskRunning();
227 
228  $this->assertTrue($result);
229  }
$result
Class ilCertificateMigration.

◆ testIsTaskStarted()

ilCertificateMigrationTest::testIsTaskStarted ( )

Definition at line 145 of file ilCertificateMigrationTest.php.

References $result.

146  {
147  $database = $this->getMockBuilder('ilDBInterface')
148  ->disableOriginalConstructor()
149  ->getMock();
150 
151  $statement = $this->getMockBuilder('ilDBStatement')
152  ->disableOriginalConstructor()
153  ->getMock();
154 
155  $statement
156  ->expects($this->atLeastOnce())
157  ->method('numRows')
158  ->willReturn(1);
159 
160  $database
161  ->expects($this->atLeastOnce())
162  ->method('queryF')
163  ->willReturn($statement);
164 
165  $database
166  ->expects($this->atLeastOnce())
167  ->method('fetchAssoc')
168  ->willReturn(array(
169  'id' => 100,
170  'usr_id' => 200,
171  'lock' => false,
172  'found_items' => 4,
173  'processed_items' => 3,
174  'migrated_items' => 5,
175  'progress' => 50,
176  'state' => 'not started',
177  'started_ts' => 123456789,
178  'finished_ts' => 987654321
179  ));
180 
181  $migration = new ilCertificateMigration(100, $database);
182 
183  $result = $migration->isTaskStarted();
184 
185  $this->assertTrue($result);
186  }
$result
Class ilCertificateMigration.

◆ testProgressedItemsAsPercent()

ilCertificateMigrationTest::testProgressedItemsAsPercent ( )

Definition at line 102 of file ilCertificateMigrationTest.php.

References $result.

103  {
104  $database = $this->getMockBuilder('ilDBInterface')
105  ->disableOriginalConstructor()
106  ->getMock();
107 
108  $statement = $this->getMockBuilder('ilDBStatement')
109  ->disableOriginalConstructor()
110  ->getMock();
111 
112  $statement
113  ->expects($this->atLeastOnce())
114  ->method('numRows')
115  ->willReturn(1);
116 
117  $database
118  ->expects($this->atLeastOnce())
119  ->method('queryF')
120  ->willReturn($statement);
121 
122  $database
123  ->expects($this->atLeastOnce())
124  ->method('fetchAssoc')
125  ->willReturn(array(
126  'id' => 100,
127  'usr_id' => 200,
128  'lock' => false,
129  'found_items' => 4,
130  'processed_items' => 3,
131  'migrated_items' => 5,
132  'progress' => 50,
133  'state' => 10,
134  'started_ts' => 123456789,
135  'finished_ts' => 987654321
136  ));
137 
138  $migration = new ilCertificateMigration(100, $database);
139 
140  $result = $migration->getProgressedItemsAsPercent();
141 
142  $this->assertEquals(75, $result);
143  }
$result
Class ilCertificateMigration.

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