Completed
Pull Request — master (#732)
by 12345
03:41
created

ImagineControllerTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A createDataManagerMock() 0 4 1
A createFilterManagerMock() 0 4 1
A createCacheManagerMock() 0 4 1
A createSignerMock() 0 4 1
A createLoggerMock() 0 4 1
A testCouldBeConstructedWithExpectedServices() 0 10 1
1
<?php
2
3
namespace Liip\ImagineBundle\Tests\Controller;
4
5
use Liip\ImagineBundle\Controller\ImagineController;
6
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
7
use Liip\ImagineBundle\Imagine\Data\DataManager;
8
use Liip\ImagineBundle\Imagine\Filter\FilterManager;
9
10
/**
11
 * @covers Liip\ImagineBundle\Controller\ImagineController
12
 */
13
class ImagineControllerTest extends \PHPUnit_Framework_TestCase
14
{
15
    public function testCouldBeConstructedWithExpectedServices()
16
    {
17
        new ImagineController(
18
            $this->createDataManagerMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createDataManagerMock() targeting Liip\ImagineBundle\Tests...createDataManagerMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Contr...ntroller::__construct() does only seem to accept object<Liip\ImagineBundl...agine\Data\DataManager>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
19
            $this->createFilterManagerMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterManagerMock() targeting Liip\ImagineBundle\Tests...eateFilterManagerMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Contr...ntroller::__construct() does only seem to accept object<Liip\ImagineBundl...e\Filter\FilterManager>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
20
            $this->createCacheManagerMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createCacheManagerMock() targeting Liip\ImagineBundle\Tests...reateCacheManagerMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Contr...ntroller::__construct() does only seem to accept object<Liip\ImagineBundl...ine\Cache\CacheManager>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
21
            $this->createSignerMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createSignerMock() targeting Liip\ImagineBundle\Tests...est::createSignerMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Contr...ntroller::__construct() does only seem to accept object<Liip\ImagineBundl...\Cache\SignerInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
22
            $this->createLoggerMock()
0 ignored issues
show
Bug introduced by
It seems like $this->createLoggerMock() targeting Liip\ImagineBundle\Tests...est::createLoggerMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Contr...ntroller::__construct() does only seem to accept null|object<Psr\Log\LoggerInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
23
        );
24
    }
25
26
    /**
27
     * @return \PHPUnit_Framework_MockObject_MockObject|DataManager
28
     */
29
    protected function createDataManagerMock()
30
    {
31
        return $this->getMock('Liip\ImagineBundle\Imagine\Data\DataManager', array(), array(), '', false);
32
    }
33
34
    /**
35
     * @return \PHPUnit_Framework_MockObject_MockObject|FilterManager
36
     */
37
    protected function createFilterManagerMock()
38
    {
39
        return $this->getMock('Liip\ImagineBundle\Imagine\Filter\FilterManager', array(), array(), '', false);
40
    }
41
42
    /**
43
     * @return \PHPUnit_Framework_MockObject_MockObject|CacheManager
44
     */
45
    protected function createCacheManagerMock()
46
    {
47
        return $this->getMock('Liip\ImagineBundle\Imagine\Cache\CacheManager', array(), array(), '', false);
48
    }
49
50
    /**
51
     * @return \PHPUnit_Framework_MockObject_MockObject|\Liip\ImagineBundle\Imagine\Cache\SignerInterface
52
     */
53
    protected function createSignerMock()
54
    {
55
        return $this->getMock('Liip\ImagineBundle\Imagine\Cache\Signer', array(), array(), '', false);
56
    }
57
58
    /**
59
     * @return \PHPUnit_Framework_MockObject_MockObject|\Psr\Log\LoggerInterface
60
     */
61
    protected function createLoggerMock()
62
    {
63
        return $this->getMock('Psr\Log\LoggerInterface');
64
    }
65
}
66