QueueCreateCommandTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B キューを作るコマンドを実行する() 0 30 1
1
<?php
2
namespace Tavii\SQSJobQueueBundle\Tests\Command;
3
4
use Phake;
5
6
use Symfony\Component\Console\Application;
7
use Symfony\Component\Console\Tester\CommandTester;
8
use Tavii\SQSJobQueueBundle\Command\QueueCreateCommand;
9
10
class QueueCreateCommandTest extends \PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @test
14
     */
15
    public function キューを作るコマンドを実行する()
16
    {
17
        $client = Phake::mock('Aws\Sqs\SqsClient');
18
        $container = Phake::mock('Symfony\Component\DependencyInjection\Container');
19
20
        Phake::when($container)->get('sqs_job_queue.client')->thenReturn($client);
21
22
23
        $application = new Application();
24
        $application->add(new QueueCreateCommand());
25
26
        $command = $application->get('sqs_job_queue:queue-create');
27
        $command->setContainer($container);
28
29
        $tester = new CommandTester($command);
30
        $tester->execute(array(
31
            'command' => $command->getName(),
32
            'queue' => 'test_queue'
33
        ));
34
35
        Phake::verify($container)->get('sqs_job_queue.client');
36
        Phake::verify($client)->createQueue(array(
37
            'QueueName' => 'test_queue',
38
            'Attributes' => array(
39
                'DelaySeconds' => 0
40
            ),
41
        ));
42
43
44
    }
45
}