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
Push — master ( 5305c0...e83c46 )
by Edi
13s
created

testCompilerPassMustThrowExceptionIfActionServiceHasntGotAlias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 0
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