15 use PHPUnit\Framework\TestCase;
25 protected function setUp():
void
30 "2024-02-16 10:00:00",
31 "2024-02-16 10:30:00",
34 "/srv/fossology/logs/123.log",
40 [
"text" =>
"Download Report",
"link" =>
"/download/report/123"]
53 $this->assertInstanceOf(JobQueue::class, $this->jobQueue);
64 $this->assertEquals(123, $this->jobQueue->getJobQueueId());
73 $this->assertEquals(
"monkbulk", $this->jobQueue->getJobQueueType());
82 $this->assertEquals(
"2024-02-16 10:00:00", $this->jobQueue->getStartTime());
91 $this->assertEquals(
"2024-02-16 10:30:00", $this->jobQueue->getEndTime());
100 $this->assertEquals(
"Completed", $this->jobQueue->getStatus());
109 $this->assertEquals(500, $this->jobQueue->getItemsProcessed());
118 $this->assertEquals(
"/srv/fossology/logs/123.log", $this->jobQueue->getLog());
127 $this->assertEquals([1, 2, 3], $this->jobQueue->getDependencies());
136 $this->assertEquals(16.67, $this->jobQueue->getItemsPerSec());
145 $this->assertEquals(
true, $this->jobQueue->isCanDoActions());
154 $this->assertEquals(
false, $this->jobQueue->isInProgress());
163 $this->assertEquals(
true, $this->jobQueue->isReady());
172 $this->assertEquals([
"text" =>
"Download Report",
"link" =>
"/download/report/123"], $this->jobQueue->getDownload());
183 $this->jobQueue->setJobQueueId(123);
184 $this->assertEquals(123, $this->jobQueue->getJobQueueId());
193 $this->jobQueue->setJobQueueType(
"monkBulk");
194 $this->assertEquals(
"monkBulk", $this->jobQueue->getJobQueueType());
203 $this->jobQueue->setStartTime(
"2024-02-16 10:00:00");
204 $this->assertEquals(
"2024-02-16 10:00:00", $this->jobQueue->getStartTime());
213 $this->jobQueue->setEndTime(
"2024-02-16 10:30:00");
214 $this->assertEquals(
"2024-02-16 10:30:00", $this->jobQueue->getEndTime());
223 $this->jobQueue->setStatus(
"Completed");
224 $this->assertEquals(
"Completed", $this->jobQueue->getStatus());
233 $this->jobQueue->setItemsProcessed(500);
234 $this->assertEquals(500, $this->jobQueue->getItemsProcessed());
243 $this->jobQueue->setItemsPerSec(16.67);
244 $this->assertEquals(16.67, $this->jobQueue->getItemsPerSec());
253 $this->jobQueue->setCanDoActions(
true);
254 $this->assertEquals(
true, $this->jobQueue->isCanDoActions());
263 $this->jobQueue->setCanDoActions(
false);
264 $this->assertEquals(
false, $this->jobQueue->isInProgress());
273 $this->jobQueue->setIsReady(
true);
274 $this->assertEquals(
true, $this->jobQueue->isReady());
283 $this->jobQueue->setLog(
null);
284 $this->assertNull($this->jobQueue->getLog());
293 $this->jobQueue->setDownload(
null);
294 $this->assertNull($this->jobQueue->getDownload());
303 $this->jobQueue->setDependencies([]);
304 $this->assertEmpty($this->jobQueue->getDependencies());
314 $json = $this->jobQueue->getJSON();
315 $this->assertJson($json);
316 $this->assertEquals($this->jobQueue->getArray(), json_decode($json,
true));
329 "jobQueueType" =>
"monkbulk",
330 "startTime" =>
"2024-02-16 10:00:00",
331 "endTime" =>
"2024-02-16 10:30:00",
332 "status" =>
"Completed",
333 "itemsProcessed" => 500,
334 "log" =>
"/srv/fossology/logs/123.log",
335 "dependencies" => [1, 2, 3],
336 "itemsPerSec" => 16.67,
337 "canDoActions" =>
true,
338 "isInProgress" =>
false,
340 "download" => [
"text" =>
"Download Report",
"link" =>
"/download/report/123"]
342 $this->assertEquals($expectedArray, $this->jobQueue->getArray());
Model class to hold JobQueue info.
Tests for JobQueue model.
testSetEmptyDependencies()