Completed
Push — master ( 5cbb35...7c6931 )
by Tomasz
02:28
created

SimpleQueueManagerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 93.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 21
c 1
b 0
f 0
wmc 2
lcom 0
cbo 3
ccs 14
cts 15
cp 0.9333
rs 10
1
<?php
2
3
namespace Gendoria\CommandQueue\Tests;
4
5
use Gendoria\CommandQueue\Command\CommandInterface;
6
use Gendoria\CommandQueue\ProcessorFactory;
7
use Gendoria\CommandQueue\QueueManager\SimpleQueueManager;
8
use Gendoria\CommandQueue\SendDriver\DirectProcessingDriver;
9
use PHPUnit_Framework_TestCase;
10
use RuntimeException;
11
12
/**
13
 * Description of SimpleQueueManagerTest
14
 *
15
 * @author Tomasz Struczyński <[email protected]>
16
 * @group CommandQueue
17
 */
18
class SimpleQueueManagerTest extends PHPUnit_Framework_TestCase
19
{
20
    public function test()
21
    {
22
        $command = $this->getMockBuilder(CommandInterface::class)->getMock();
23
        $qm = new SimpleQueueManager();
24
        $processorFactory = new ProcessorFactory();
25
        $driver = new DirectProcessingDriver();
26
        $driver->setProcessorFactory($processorFactory);
27
        $qm->setSendDriver($driver);
28
        $qm->sendCommand($command);
29
    }
30
    
31
    public function testNoSendDriver()
32
    {
33
        $this->setExpectedException(RuntimeException::class, 'Send driver not set');
34
        $command = $this->getMockBuilder(CommandInterface::class)->getMock();
35
        $qm = new SimpleQueueManager();
36
        $qm->sendCommand($command);
37
    }
38
}
39