ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateMigrationInformationObjectTest.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{
10 {
11 $array = array(
12 'id' => 100,
13 'usr_id' => 200,
14 'lock' => true,
15 'found_items' => 4,
16 'processed_items' => 3,
17 'migrated_items' => 5,
18 'progress' => 50,
19 'state' => 'finished',
20 'started_ts' => 123456789,
21 'finished_ts' => 987654321
22 );
23
24 $informationObject = new ilCertificateMigrationInformationObject($array);
25
26 $this->assertEquals(100, $informationObject->getId());
27 $this->assertEquals(200, $informationObject->getUserId());
28 $this->assertEquals(true, $informationObject->getLock());
29 $this->assertEquals(4, $informationObject->getFoundItems());
30 $this->assertEquals(3, $informationObject->getProgressedItems());
31 $this->assertEquals('finished', $informationObject->getState());
32 $this->assertEquals(50, $informationObject->getProgress());
33 $this->assertEquals(123456789, $informationObject->getStartingTime());
34 $this->assertEquals(987654321, $informationObject->getFinishedTime());
35 $this->assertEquals((987654321 - 123456789), $informationObject->getProcessingTime());
36 }
37
38 public function testCreatingObjectAsArray()
39 {
40 $array = array(
41 'id' => 100,
42 'usr_id' => 200,
43 'lock' => true,
44 'found_items' => 4,
45 'processed_items' => 3,
46 'migrated_items' => 5,
47 'progress' => 50,
48 'state' => 'finished',
49 'started_ts' => 123456789,
50 'finished_ts' => 987654321
51 );
52
53 $informationObject = new ilCertificateMigrationInformationObject($array);
54 $dataArray = $informationObject->getDataAsArray();
55
56 $this->assertEquals(array(
57 'id' => 100,
58 'usr_id' => 200,
59 'lock' => 1,
60 'found_items' => 4,
61 'processed_items' => 3,
62 'progress' => 50,
63 'state' => 'finished',
64 'started_ts' => 123456789,
65 'finished_ts' => 987654321
66 ), $dataArray);
67 }
68}
An exception for terminatinating execution or to throw for unit testing.