Completed
Push — develop ( 4ff741...64bd10 )
by Tom
14:53
created

GetClassifiersCommandTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 29
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCommand() 0 23 1
1
<?php
2
3
namespace Bobbyshaw\WatsonVisualRecognition\Tests\Commands;
4
5
use Bobbyshaw\WatsonVisualRecognition\Client;
6
use Bobbyshaw\WatsonVisualRecognition\Commands\GetClassifiersCommand;
7
use Bobbyshaw\WatsonVisualRecognition\Tests\Base;
8
use Symfony\Component\Console\Input\ArrayInput;
9
use Symfony\Component\Console\Output\BufferedOutput;
10
11
class GetClassifiersCommandTest extends Base
12
{
13
    /**
14
     * Test that the command outputs a table of classifiers
15
     */
16
    public function testCommand()
17
    {
18
        $container = [];
19
        $response = $this->getMockHttpResponse('GetClassifiersSuccess.txt');
20
        $httpClient = $this->getMockHttpClientWithHistoryAndResponses($container, [$response]);
21
22
        $arguments = [
23
            'username' => 'test',
24
            'password' => 'test',
25
            '--version-date' => '2016-01-01'
26
        ];
27
        $input = new ArrayInput($arguments);
28
        $output = new BufferedOutput();
29
30
        $command = new GetClassifiersCommand(null, new Client($httpClient));
31
        $command->run($input, $output);
32
33
        $this->assertEquals('classifiers:get', $command->getName());
34
35
        $correctOutput = file_get_contents('Tests/Mock/Commands/CLassifiersSuccess.txt');
36
37
        $this->assertEquals($correctOutput, $output->fetch());
38
    }
39
}
40