Completed
Pull Request — master (#128)
by
unknown
03:11 queued 55s
created

PathHelperTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testHelperWithSymfony2() 0 23 1
A testHelperWithSymfony3() 0 23 1
1
<?php
2
3
namespace Liip\MonitorBundle\Tests\Helper;
4
5
use Liip\MonitorBundle\Helper\PathHelper;
6
7
class PathHelperTest extends \PHPUnit_Framework_TestCase
8
{
9
10
    public function testHelperWithSymfony2()
11
    {
12
        $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
13
        $container
14
            ->expects($this->any())
15
            ->method('getParameter')
16
            ->with('templating.helper.assets')
17
            ->willReturn('Exist');
18
19
        $container
20
            ->expects($this->any())
21
            ->method('getParameter')
22
            ->with('assets.packages')
23
            ->will($this->throwException(new \Exception()));
24
25
        $container
26
            ->expects($this->any())
27
            ->method('has')
28
            ->with('templating.helper.assets')
29
            ->willReturn(true);
30
31
        $this->assertInstanceOf('Liip\MonitorBundle\Helper\PathHelper', new PathHelper($container, '2.0.1'));
32
    }
33
34
    public function testHelperWithSymfony3()
35
    {
36
        $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
37
        $container
38
            ->expects($this->any())
39
            ->method('getParameter')
40
            ->with('assets.packages')
41
            ->willReturn('Exist');
42
43
        $container
44
            ->expects($this->any())
45
            ->method('getParameter')
46
            ->with('templating.helper.assets')
47
            ->will($this->throwException(new \Exception()));
48
49
        $container
50
            ->expects($this->any())
51
            ->method('has')
52
            ->with('templating.helper.assets')
53
            ->willReturn(false);
54
55
        $this->assertInstanceOf('Liip\MonitorBundle\Helper\PathHelper', new PathHelper($container, '3.0.1'));
56
    }
57
58
}
59