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

Public Member Functions

 testEntryCanBeAddedToQueue ()
 
 testRemoveFromQueue ()
 
 testFetchAllEntriesFromQueue ()
 

Detailed Description

Member Function Documentation

◆ testEntryCanBeAddedToQueue()

ilCertificateQueueRepositoryTest::testEntryCanBeAddedToQueue ( )

Definition at line 9 of file ilCertificateQueueRepositoryTest.php.

10 {
11 $databaseMock = $this->getMockBuilder('ilDBInterface')
12 ->getMock();
13
14 $loggerMock = $this->getMockBuilder('ilLogger')
15 ->disableOriginalConstructor()
16 ->getMock();
17
18 $timestamp = time();
19
20 $databaseMock->expects($this->once())
21 ->method('nextId')
22 ->willReturn(20);
23
24 $loggerMock->expects($this->atLeastOnce())
25 ->method('info');
26
27 $loggerMock->expects($this->atLeastOnce())
28 ->method('debug');
29
30 $databaseMock->expects($this->once())
31 ->method('insert')
32 ->with(
33 'il_cert_cron_queue',
34 array(
35 'id' => array('integer', 20),
36 'obj_id' => array('integer', 10),
37 'usr_id' => array('integer', 500),
38 'adapter_class' => array('text', 'SomeClass'),
39 'state' => array('text', 'SomeState'),
40 'started_timestamp' => array('integer', $timestamp),
41 'template_id' => array('integer', 10000)
42 )
43 );
44
45 $repository = new ilCertificateQueueRepository($databaseMock, $loggerMock);
46
47 $queueEntry = new ilCertificateQueueEntry(
48 10,
49 500,
50 'SomeClass',
51 'SomeState',
52 10000,
54 );
55
56 $repository->addToQueue($queueEntry);
57 }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.

References $timestamp, and Sabre\Event\once().

+ Here is the call graph for this function:

◆ testFetchAllEntriesFromQueue()

ilCertificateQueueRepositoryTest::testFetchAllEntriesFromQueue ( )

Definition at line 85 of file ilCertificateQueueRepositoryTest.php.

86 {
87 $databaseMock = $this->getMockBuilder('ilDBInterface')
88 ->getMock();
89
90 $loggerMock = $this->getMockBuilder('ilLogger')
91 ->disableOriginalConstructor()
92 ->getMock();
93
94 $loggerMock->expects($this->atLeastOnce())
95 ->method('info');
96
97 $loggerMock->expects($this->atLeastOnce())
98 ->method('debug');
99
100 $databaseMock->expects($this->once())
101 ->method('query');
102
103 $databaseMock->expects($this->exactly(3))
104 ->method('fetchAssoc')
105 ->willReturnOnConsecutiveCalls(
106 array(
107 'id' => 10,
108 'obj_id' => 100,
109 'usr_id' => 5000,
110 'adapter_class' => 'SomeClass',
111 'state' => 'SomeState',
112 'template_id' => 1000,
113 'started_timestamp' => 123456789
114 ),
115 array(
116 'id' => 20,
117 'obj_id' => 100,
118 'usr_id' => 5000,
119 'adapter_class' => 'SomeClass',
120 'state' => 'SomeState',
121 'template_id' => 1000,
122 'started_timestamp' => 123456789
123 )
124 );
125
126 $repository = new ilCertificateQueueRepository($databaseMock, $loggerMock);
127
128 $entries = $repository->getAllEntriesFromQueue();
129
130 $this->assertEquals(10, $entries[0]->getId());
131 $this->assertEquals(20, $entries[1]->getId());
132 }

References Sabre\Event\once().

+ Here is the call graph for this function:

◆ testRemoveFromQueue()

ilCertificateQueueRepositoryTest::testRemoveFromQueue ( )

Definition at line 59 of file ilCertificateQueueRepositoryTest.php.

60 {
61 $databaseMock = $this->getMockBuilder('ilDBInterface')
62 ->getMock();
63
64 $loggerMock = $this->getMockBuilder('ilLogger')
65 ->disableOriginalConstructor()
66 ->getMock();
67
68 $loggerMock->expects($this->atLeastOnce())
69 ->method('info');
70
71 $databaseMock->expects($this->once())
72 ->method('quote')
73 ->with(30, 'integer')
74 ->willReturn(30);
75
76 $databaseMock->expects($this->once())
77 ->method('manipulate')
78 ->with('DELETE FROM il_cert_cron_queue WHERE id = 30');
79
80 $repository = new ilCertificateQueueRepository($databaseMock, $loggerMock);
81
82 $repository->removeFromQueue(30);
83 }

References Sabre\Event\once().

+ Here is the call graph for this function:

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