Completed
Pull Request — master (#128)
by
unknown
02:19
created

PathHelperTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
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 54
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B testHelperWithSymfony2() 0 24 1
B testHelperWithSymfony3() 0 24 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
26
        $container
27
            ->expects($this->any())
28
            ->method('has')
29
            ->with('templating.helper.assets')
30
            ->willReturn(true);
31
32
        $this->assertInstanceOf('Liip\MonitorBundle\Helper\PathHelper', new PathHelper($container, '2.0.1'));
33
    }
34
35
    public function testHelperWithSymfony3()
36
    {
37
        $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
38
        $container
39
            ->expects($this->any())
40
            ->method('getParameter')
41
            ->with('assets.packages')
42
            ->willReturn('Exist');
43
44
        $container
45
            ->expects($this->any())
46
            ->method('getParameter')
47
            ->with('templating.helper.assets')
48
            ->will($this->throwException(new \Exception));
49
50
51
        $container
52
            ->expects($this->any())
53
            ->method('has')
54
            ->with('templating.helper.assets')
55
            ->willReturn(false);
56
57
        $this->assertInstanceOf('Liip\MonitorBundle\Helper\PathHelper', new PathHelper($container, '3.0.1'));
58
    }
59
60
}
61