Completed
Push — master ( 008bc0...0640ce )
by
unknown
46:22 queued 05:29
created

JobFailedEventTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testEvent() 0 15 1
1
<?php
2
3
namespace SfCod\QueueBundle\Tests\Event;
4
5
use PHPUnit\Framework\TestCase;
6
use SfCod\QueueBundle\Event\JobFailedEvent;
7
use SfCod\QueueBundle\Job\JobContractInterface;
8
use Exception;
9
use Symfony\Component\EventDispatcher\Event;
10
11
/**
12
 * Class JobFailedEventTest
13
 * @author Virchenko Maksim <[email protected]>
14
 * @package SfCod\QueueBundle\Tests\Event
15
 */
16
class JobFailedEventTest extends TestCase
17
{
18
    /**
19
     * Test event
20
     */
21
    public function testEvent()
22
    {
23
        $message = uniqid('message_');
24
        $connectionName = uniqid('connection_');
25
        $job = $this->createMock(JobContractInterface::class);
26
        $exception = new Exception($message);
27
28
        $event = new JobFailedEvent($connectionName, $job, $exception);
29
30
        $this->assertInstanceOf(Event::class, $event);
31
        $this->assertEquals($connectionName, $event->getConnectionName());
32
        $this->assertEquals($job, $event->getJob());
33
        $this->assertEquals($exception, $event->getException());
34
        $this->assertEquals($exception->getMessage(), $event->getException()->getMessage());
35
    }
36
}