GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#9)
by Mario
01:45
created

MetaTagHandlersCompilerPassTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 5
dl 0
loc 65
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
B testCompilerPassCollectsValidServices() 0 33 1
A testCompilerPassMustThrowExceptionIfActionServiceHasntGotAlias() 0 19 1
A registerCompilerPass() 0 4 1
1
<?php
2
3
namespace Netgen\Bundle\OpenGraphBundle\Tests\DependencyInjection\Compiler;
4
5
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
6
use Netgen\Bundle\OpenGraphBundle\DependencyInjection\Compiler\MetaTagHandlersCompilerPass;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Definition;
9
use Symfony\Component\DependencyInjection\Reference;
10
11
class MetaTagHandlersCompilerPassTest extends AbstractCompilerPassTestCase
12
{
13
    public function testCompilerPassCollectsValidServices()
14
    {
15
        $handlerRegistry = new Definition();
16
        $this->setDefinition('netgen_open_graph.handler_registry', $handlerRegistry);
17
18
        $handlerOne = new Definition();
19
        $handlerOne->addTag('netgen_open_graph.meta_tag_handler', array('alias' => 'field_type/eztext'));
20
        $this->setDefinition('handler_one', $handlerOne);
21
22
        $handlerTwo = new Definition();
23
        $handlerTwo->addTag('netgen_open_graph.meta_tag_handler', array('alias' => 'literal/text'));
24
        $this->setDefinition('handler_two', $handlerTwo);
25
26
        $this->compile();
27
28
        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
29
            'netgen_open_graph.handler_registry',
30
            'addHandler',
31
            array(
32
                'field_type/eztext',
33
                new Reference('handler_one'),
34
            )
35
        );
36
37
        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
38
            'netgen_open_graph.handler_registry',
39
            'addHandler',
40
            array(
41
                'literal/text',
42
                new Reference('handler_two'),
43
            )
44
        );
45
    }
46
47
    /**
48
     * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
49
     * @expectedExceptionMessage netgen_open_graph.meta_tag_handler service tag needs an "alias" attribute to identify the handler. None given.
50
     */
51
    public function testCompilerPassMustThrowExceptionIfActionServiceHasntGotAlias()
52
    {
53
        $handlerRegistry = new Definition();
54
        $this->setDefinition('netgen_open_graph.handler_registry', $handlerRegistry);
55
56
        $handlerOne = new Definition();
57
        $handlerOne->addTag('netgen_open_graph.meta_tag_handler');
58
        $this->setDefinition('handler_one', $handlerOne);
59
60
        $this->compile();
61
62
        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
63
            'netgen_open_graph.handler_registry',
64
            'addHandler',
65
            array(
66
                new Reference('handler_one'),
67
            )
68
        );
69
    }
70
71
    protected function registerCompilerPass(ContainerBuilder $container)
72
    {
73
        $container->addCompilerPass(new MetaTagHandlersCompilerPass());
74
    }
75
}
76