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

NetgenOpenGraphExtensionTwigTest::getExtensions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Netgen\Bundle\OpenGraphBundle\Tests\Templating\Twig\Extension;
4
5
use Netgen\Bundle\OpenGraphBundle\MetaTag\Collector;
6
use Netgen\Bundle\OpenGraphBundle\MetaTag\Item;
7
use Netgen\Bundle\OpenGraphBundle\MetaTag\Renderer;
8
use Netgen\Bundle\OpenGraphBundle\Templating\Twig\Extension\NetgenOpenGraphExtension;
9
use Netgen\Bundle\OpenGraphBundle\Templating\Twig\Extension\NetgenOpenGraphRuntime;
10
use Psr\Log\NullLogger;
11
use Twig\RuntimeLoader\FactoryRuntimeLoader;
12
use Twig\Test\IntegrationTestCase;
13
14
class NetgenOpenGraphExtensionTwigTest extends IntegrationTestCase
15
{
16
    /**
17
     * @var \Netgen\Bundle\OpenGraphBundle\Templating\Twig\Extension\NetgenOpenGraphExtension
18
     */
19
    protected $extension;
20
21
    /**
22
     * @var \Netgen\Bundle\OpenGraphBundle\Templating\Twig\Extension\NetgenOpenGraphRuntime
23
     */
24
    protected $runtime;
25
26
    /**
27
     * @var \PHPUnit_Framework_MockObject_MockObject
28
     */
29
    protected $collector;
30
31
    /**
32
     * @var \PHPUnit_Framework_MockObject_MockObject
33
     */
34
    protected $renderer;
35
36
    /**
37
     * @var \PHPUnit_Framework_MockObject_MockObject
38
     */
39
    protected $logger;
40
41
    public function setUp()
42
    {
43
        /** @var Item[] $items */
44
        $items = array(
45
            new Item('tag1', 'some_value'),
46
        );
47
48
        $this->collector = $this->getMockBuilder(Collector::class)
49
            ->disableOriginalConstructor()
50
            ->setMethods(array('collect'))
51
            ->getMock();
52
53
        $this->collector->method('collect')
54
            ->willReturn($items);
55
56
        $this->renderer = $this->getMockBuilder(Renderer::class)
57
            ->disableOriginalConstructor()
58
            ->setMethods(array('render'))
59
            ->getMock();
60
61
        $html = '';
62
        foreach ($items as $item) {
63
            $html .= "<meta property=\"{$item->getTagName()}\" content=\"{$item->getTagValue()}\" />\n";
64
        }
65
66
        $this->renderer->method('render')
67
            ->willReturn($html);
68
69
        $this->logger = $this->getMockBuilder(NullLogger::class)
70
            ->disableOriginalConstructor()
71
            ->setMethods(array('error'))
72
            ->getMock();
73
74
        $this->extension = new NetgenOpenGraphExtension();
75
        $this->runtime = new NetgenOpenGraphRuntime($this->collector, $this->renderer, $this->logger);
0 ignored issues
show
Documentation introduced by
$this->collector is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Netgen\Bundle\Ope...Tag\CollectorInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$this->renderer is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Netgen\Bundle\Ope...aTag\RendererInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$this->logger is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a null|object<Psr\Log\LoggerInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    protected function getFixturesDir()
82
    {
83
        return __DIR__ . '/_fixtures/';
84
    }
85
86
    protected function getExtensions()
87
    {
88
        return array($this->extension);
89
    }
90
91
    protected function getRuntimeLoaders()
92
    {
93
        return array(
94
            new FactoryRuntimeLoader(
95
                array(
96
                    NetgenOpenGraphRuntime::class => function () {
97
                        return $this->runtime;
98
                    },
99
                )
100
            ),
101
        );
102
    }
103
}
104