Code Duplication    Length = 22-24 lines in 3 locations

Tests/Commands/GetClassifierCommandTest.php 1 location

@@ 16-39 (lines=24) @@
13
    /**
14
     * Test that the command outputs a table of classifiers
15
     */
16
    public function testCommand()
17
    {
18
        $container = [];
19
        $response = $this->getMockHttpResponse('GetClassifierSuccess.txt');
20
        $httpClient = $this->getMockHttpClientWithHistoryAndResponses($container, [$response]);
21
22
        $arguments = [
23
            'username' => 'test',
24
            'password' => 'test',
25
            'classifier_id' => 'Magenta',
26
            '--version-date' => '2016-01-01',
27
        ];
28
        $input = new ArrayInput($arguments);
29
        $output = new BufferedOutput();
30
31
        $command = new GetClassifierCommand(null, new Client($httpClient));
32
        $command->run($input, $output);
33
34
        $this->assertEquals('classifier:get', $command->getName());
35
36
        $correctOutput = file_get_contents('Tests/Mock/Commands/ClassifierSuccess.txt');
37
38
        $this->assertEquals($correctOutput, $output->fetch());
39
    }
40
}
41

Tests/Commands/GetClassifiersCommandTest.php 1 location

@@ 40-63 (lines=24) @@
37
        $this->assertEquals($correctOutput, $output->fetch());
38
    }
39
40
    public function testVerboseCommand()
41
    {
42
        $container = [];
43
        $response = $this->getMockHttpResponse('GetClassifiersVerbose.txt');
44
        $httpClient = $this->getMockHttpClientWithHistoryAndResponses($container, [$response]);
45
46
        $arguments = [
47
            'username' => 'test',
48
            'password' => 'test',
49
            '--version-date' => '2016-01-01',
50
            '--api-verbose'  => 'true'
51
        ];
52
        $input = new ArrayInput($arguments);
53
        $output = new BufferedOutput();
54
55
        $command = new GetClassifiersCommand(null, new Client($httpClient));
56
        $command->run($input, $output);
57
58
        $this->assertEquals('classifiers:get', $command->getName());
59
60
        $correctOutput = file_get_contents('Tests/Mock/Commands/ClassifiersVerboseSuccess.txt');
61
62
        $this->assertEquals($correctOutput, $output->fetch());
63
    }
64
}
65

Tests/Commands/DeleteClassifierCommandTest.php 1 location

@@ 41-62 (lines=22) @@
38
        $this->assertEquals($correctOutput, $output->fetch());
39
    }
40
41
    public function testCommandFail()
42
    {
43
        $container = [];
44
        $response = $this->getMockHttpResponse('DeleteClassifierFail.txt');
45
        $httpClient = $this->getMockHttpClientWithHistoryAndResponses($container, [$response]);
46
47
        $arguments = [
48
            'username' => 'test',
49
            'password' => 'test',
50
            'classifier_id' => 'Sunset',
51
            '--version-date' => '2016-01-01',
52
        ];
53
        $input = new ArrayInput($arguments);
54
        $output = new BufferedOutput();
55
56
        $command = new DeleteClassifierCommand(null, new Client($httpClient));
57
        $command->run($input, $output);
58
59
        $this->assertEquals('classifier:delete', $command->getName());
60
61
        $this->assertEquals("Cannot delete classifier: Sunset\n", $output->fetch());
62
    }
63
}
64