ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 26 of file ilCertificateQueueRepositoryTest.php.

References $timestamp.

26  : void
27  {
28  $databaseMock = $this->createMock(ilDBInterface::class);
29 
30  $loggerMock = $this->getMockBuilder(ilLogger::class)
31  ->disableOriginalConstructor()
32  ->getMock();
33 
34  $timestamp = time();
35 
36  $databaseMock->expects($this->once())
37  ->method('nextId')
38  ->willReturn(20);
39 
40  $loggerMock->expects($this->atLeastOnce())
41  ->method('debug');
42 
43  $loggerMock->expects($this->atLeastOnce())
44  ->method('debug');
45 
46  $databaseMock->expects($this->once())
47  ->method('insert')
48  ->with(
49  'il_cert_cron_queue',
50  [
51  'id' => ['integer', 20],
52  'obj_id' => ['integer', 10],
53  'usr_id' => ['integer', 500],
54  'adapter_class' => ['text', 'SomeClass'],
55  'state' => ['text', 'SomeState'],
56  'started_timestamp' => ['integer', $timestamp],
57  'template_id' => ['integer', 10000]
58  ]
59  );
60 
61  $repository = new ilCertificateQueueRepository($databaseMock, $loggerMock);
62 
63  $queueEntry = new ilCertificateQueueEntry(
64  10,
65  500,
66  'SomeClass',
67  'SomeState',
68  10000,
70  );
71 
72  $repository->addToQueue($queueEntry);
73  }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70

◆ testFetchAllEntriesFromQueue()

ilCertificateQueueRepositoryTest::testFetchAllEntriesFromQueue ( )

Definition at line 100 of file ilCertificateQueueRepositoryTest.php.

References ILIAS\Survey\Mode\getId().

100  : void
101  {
102  $databaseMock = $this->createMock(ilDBInterface::class);
103 
104  $loggerMock = $this->getMockBuilder(ilLogger::class)
105  ->disableOriginalConstructor()
106  ->getMock();
107 
108  $loggerMock->expects($this->atLeastOnce())
109  ->method('debug');
110 
111  $loggerMock->expects($this->atLeastOnce())
112  ->method('debug');
113 
114  $databaseMock->expects($this->once())
115  ->method('query');
116 
117  $databaseMock->expects($this->exactly(3))
118  ->method('fetchAssoc')
119  ->willReturnOnConsecutiveCalls(
120  [
121  'id' => 10,
122  'obj_id' => 100,
123  'usr_id' => 5000,
124  'adapter_class' => 'SomeClass',
125  'state' => 'SomeState',
126  'template_id' => 1000,
127  'started_timestamp' => 123456789
128  ],
129  [
130  'id' => 20,
131  'obj_id' => 100,
132  'usr_id' => 5000,
133  'adapter_class' => 'SomeClass',
134  'state' => 'SomeState',
135  'template_id' => 1000,
136  'started_timestamp' => 123456789
137  ]
138  );
139 
140  $repository = new ilCertificateQueueRepository($databaseMock, $loggerMock);
141 
142  $entries = $repository->getAllEntriesFromQueue();
143 
144  $this->assertSame(10, $entries[0]->getId());
145  $this->assertSame(20, $entries[1]->getId());
146  }
+ Here is the call graph for this function:

◆ testRemoveFromQueue()

ilCertificateQueueRepositoryTest::testRemoveFromQueue ( )

Definition at line 75 of file ilCertificateQueueRepositoryTest.php.

75  : void
76  {
77  $databaseMock = $this->createMock(ilDBInterface::class);
78 
79  $loggerMock = $this->getMockBuilder(ilLogger::class)
80  ->disableOriginalConstructor()
81  ->getMock();
82 
83  $loggerMock->expects($this->atLeastOnce())
84  ->method('debug');
85 
86  $databaseMock->expects($this->once())
87  ->method('quote')
88  ->with(30, 'integer')
89  ->willReturn('30');
90 
91  $databaseMock->expects($this->once())
92  ->method('manipulate')
93  ->with('DELETE FROM il_cert_cron_queue WHERE id = 30');
94 
95  $repository = new ilCertificateQueueRepository($databaseMock, $loggerMock);
96 
97  $repository->removeFromQueue(30);
98  }

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