Completed
Push — master ( 6d2f87...a1ca3e )
by
unknown
83:38 queued 43:39
created

JobTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B testJob() 0 24 1
1
<?php
2
3
namespace SfCod\QueueBundle\Tests\Entity;
4
5
use PHPUnit\Framework\TestCase;
6
use SfCod\QueueBundle\Entity\Job;
7
8
/**
9
 * Class JobTest
10
 * @author Virchenko Maksim <[email protected]>
11
 * @package SfCod\QueueBundle\Tests\Entity
12
 */
13
class JobTest extends TestCase
14
{
15
    /**
16
     * Test job
17
     */
18
    public function testJob()
19
    {
20
        $id = rand(1, 99999);
21
        $attempts = rand(1, 10);
22
        $queue = uniqid('queue_');
23
        $reserved = (bool)rand(0, 1);
24
        $reservedAt = time();
25
        $payload = range(1, 100);
26
27
        $job = new Job();
28
        $job->setId($id);
29
        $job->setAttempts($attempts);
30
        $job->setQueue($queue);
31
        $job->setReserved($reserved);
32
        $job->setReservedAt($reservedAt);
33
        $job->setPayload($payload);
34
35
        $this->assertEquals($id, $job->getId());
36
        $this->assertEquals($attempts, $job->getAttempts());
37
        $this->assertEquals($queue, $job->getQueue());
38
        $this->assertEquals($reserved, $job->isReserved());
39
        $this->assertEquals($reservedAt, $job->getReservedAt());
40
        $this->assertEquals($payload, $job->getPayload());
41
    }
42
}