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

SimpleQueueManagerTest::test()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
ccs 9
cts 9
cp 1
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
crap 1
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