ThumbnailerTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testCreateService() 0 21 1
1
<?php
2
3
namespace DmFilemanTest\Factory\Service;
4
5
use DmFileman\Factory\Service\Thumbnailer;
6
7
use DmTest\ServiceManager\ServiceLocatorDummy;
8
9
class ThumbnailerTest extends \PHPUnit_Framework_TestCase
10
{
11
    /** @var Thumbnailer */
12
    private $sut;
13
14
    public function setUp()
15
    {
16
        $this->sut = new Thumbnailer;
17
    }
18
19
    /**
20
     * @covers DmFileman\Factory\Service\Thumbnailer
21
     */
22
    public function testCreateService()
23
    {
24
        $serviceLocator = new ServiceLocatorDummy($this);
25
26
        $optionsStub = $this->getMockBuilder('DmFileman\Helper\Options')
27
            ->setMethods(['getThumbsOptions'])
28
            ->disableOriginalConstructor()
29
            ->getMock();
30
        $optionsStub->expects($this->any())->method('getThumbsOptions')->willReturn([]);
31
        $serviceLocator->set('DmFileman\Helper\Options', $optionsStub);
32
33
        $imagineStub = $this->getMockBuilder('Imagine\Gd\Imagine')
34
            ->setMethods([])
35
            ->disableAutoload()
36
            ->getMock();
37
        $serviceLocator->set('Imagine\Gd\Imagine', $imagineStub);
38
39
        $result = $this->sut->createService($serviceLocator);
40
41
        $this->assertInstanceOf('DmFileman\Service\Thumbnailer\Thumbnailer', $result);
42
    }
43
}
44