Completed
Push — develop ( 3bcd98...bdc471 )
by Tom
02:31
created

CreateClassifierCommandTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B testCommand() 0 27 1
1
<?php
2
3
namespace Bobbyshaw\WatsonVisualRecognition\Tests\Commands;
4
5
use Bobbyshaw\WatsonVisualRecognition\Client;
6
use Bobbyshaw\WatsonVisualRecognition\Commands\CreateClassifierCommand;
7
use Bobbyshaw\WatsonVisualRecognition\Tests\Base;
8
use Symfony\Component\Console\Input\ArrayInput;
9
use Symfony\Component\Console\Output\BufferedOutput;
10
11
class CreateClassifierCommandTest extends Base
12
{
13
    public function testCommand()
14
    {
15
        $container = [];
16
        $response = $this->getMockHttpResponse('CreateClassifierSuccess.txt');
17
        $httpClient = $this->getMockHttpClientWithHistoryAndResponses($container, [$response]);
18
19
        $arguments = [
20
            'username' => 'test',
21
            'password' => 'test',
22
            'positive_examples' => 'Tests/images/butterfly-positive.zip',
23
            'negative_examples' => 'Tests/images/butterfly-negative.zip',
24
            'name' => 'butterfly',
25
            '--version-date' => '2016-01-01'
26
        ];
27
        $input = new ArrayInput($arguments);
28
29
        $output = new BufferedOutput();
30
31
        $command = new CreateClassifierCommand(null, new Client($httpClient));
32
        $command->run($input, $output);
33
34
        $this->assertEquals('classifier:create', $command->getName());
35
36
        $correctOutput = file_get_contents('Tests/Mock/Commands/CreateClassifierSuccess.txt');
37
38
        $this->assertEquals($correctOutput, $output->fetch());
39
    }
40
}
41