QueueListCommandTest::キュー一覧を取得するコマンドを実行する()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 18
nc 1
nop 0
1
<?php
2
namespace Tavii\SQSJobQueueBundle\Tests\Command;
3
4
use Phake;
5
use Symfony\Component\Console\Application;
6
use Symfony\Component\Console\Tester\CommandTester;
7
use Tavii\SQSJobQueueBundle\Command\QueueListCommand;
8
9
class QueueListCommandTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @test
13
     */
14
    public function キュー一覧を取得するコマンドを実行する()
15
    {
16
        $client = Phake::mock('Aws\Sqs\SqsClient');
17
        $container = Phake::mock('Symfony\Component\DependencyInjection\Container');
18
19
        Phake::when($container)->get('sqs_job_queue.client')->thenReturn($client);
20
        Phake::when($client)->listQueues($this->isType('array'))
21
            ->thenReturn(array(
22
                'QueueUrls' => array('/path/to/url'),
23
            ));
24
25
        $application = new Application();
26
        $application->add(new QueueListCommand());
27
28
        $command = $application->get('sqs_job_queue:queue-list');
29
        $command->setContainer($container);
30
31
        $tester = new CommandTester($command);
32
        $tester->execute(array(
33
            'command' => $command->getName(),
34
            '--queueNamePrefix' => 'test'
35
        ));
36
37
        Phake::verify($container)->get('sqs_job_queue.client');
38
        Phake::verify($client)->listQueues(array(
39
            'QueueNamePrefix' => 'test'
40
        ));
41
    }
42
}