ThumbnailerTest::testCreateService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 21
rs 9.3143
cc 1
eloc 15
nc 1
nop 0
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