CollectorSubscriberTest::testCompilerPass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/**
4
* This file is part of the Meup TagCommander Bundle.
5
*
6
* (c) 1001pharmacies <http://github.com/1001pharmacies/tagcommander-bundle>
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
namespace Meup\Bundle\TagcommanderBundle\DependencyInjection\CompilerPass;
13
14
use Meup\Bundle\TagcommanderBundle\DependencyInjection\CompilerPass\CollectorSubscriber;
15
use Symfony\Component\DependencyInjection\Reference;
16
17
/**
18
 *
19
 */
20
class CollectorSubscriberTest extends \PHPUnit_Framework_TestCase
21
{
22
    /**
23
     * @return Symfony\Component\DependencyInjection\Definition
24
     */
25
    private function getDispatcher()
26
    {
27
        $dispatcher = $this
28
            ->getMockBuilder('Symfony\Component\DependencyInjection\Definition')
29
            ->setMethods(array('addMethodCall'))
30
            ->getMock()
31
        ;
32
        $dispatcher
33
            ->expects($this->once())
34
            ->method('addMethodCall')
35
            ->with(
36
                $this->equalTo('addSubscriber'),
37
                $this->equalTo(array(new Reference('meup_tagcommander.datacollector_subscriber')))
38
            )
39
        ;
40
41
        return $dispatcher;
42
    }
43
44
    /**
45
     * @return Symfony\Component\DependencyInjection\ContainerBuilder
46
     */
47
    private function getContainer()
48
    {
49
        $container = $this
50
            ->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')
51
            ->getMock()
52
        ;
53
        $container
54
            ->method('findDefinition')
55
            ->willReturn($this->getDispatcher())
56
        ;
57
58
        return $container;
59
    }
60
61
    /**
62
     *
63
     */
64
    public function testCompilerPass()
65
    {
66
        $collectorSubscriber = new CollectorSubscriber();
67
        $collectorSubscriber->process($this->getContainer());
68
    }
69
}
70