ImageTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 5
c 2
b 0
f 1
lcom 1
cbo 1
dl 0
loc 37
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testGetName() 0 4 1
A testGetClassifiers() 0 4 1
A testGetClassifier() 0 4 1
A testGetClassifierNotFound() 0 4 1
1
<?php
2
3
namespace Bobbyshaw\WatsonVisualRecognition\Tests;
4
5
use Bobbyshaw\WatsonVisualRecognition\Classifier;
6
use Bobbyshaw\WatsonVisualRecognition\Image;
7
8
/**
9
 * Class ImageTest
10
 * @package Bobbyshaw\WatsonVisualRecognition\Tests
11
 */
12
class ImageTest extends Base
13
{
14
    /** @var Image */
15
    private $image;
16
17
    /** @var Classifier[] */
18
    private $classifiers;
19
20
    private $imageName = 'parrot';
21
22
23
    public function setUp()
24
    {
25
        $this->classifiers = [new Classifier('test', 'test', 'test')];
26
        $this->image = new Image($this->imageName, $this->classifiers);
27
    }
28
29
    public function testGetName()
30
    {
31
        $this->assertEquals($this->imageName, $this->image->getName());
32
    }
33
34
    public function testGetClassifiers()
35
    {
36
        $this->assertEquals($this->classifiers, $this->image->getClassifiers());
37
    }
38
39
    public function testGetClassifier()
40
    {
41
        $this->assertEquals($this->classifiers[0], $this->image->getClassifier('test'));
42
    }
43
44
    public function testGetClassifierNotFound()
45
    {
46
        $this->assertEquals(false, $this->image->getClassifier('foobar'));
47
    }
48
}
49