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 ( 3011cb...e235be )
by Christian
17:28
created

testRenderTrackerWithoutSiteId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * (c) Christian Gripp <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Core23\MatomoBundle\Tests\Twig\Extension;
11
12
use Core23\MatomoBundle\Twig\Extension\MatomoTwigExtension;
13
use PHPUnit\Framework\TestCase;
14
use Prophecy\Argument;
15
use Twig\Environment;
16
use Twig\TwigFunction;
17
18
class MatomoTwigExtensionTest extends TestCase
19
{
20
    private $environment;
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    protected function setUp(): void
26
    {
27
        $this->environment = $this->prophesize(Environment::class);
28
    }
29
30
    public function testGetFunctions(): void
31
    {
32
        $extension = new MatomoTwigExtension($this->environment->reveal());
33
34
        $functions = $extension->getFunctions();
35
36
        $this->assertCount(1, $functions);
37
38
        foreach ($functions as $function) {
39
            $this->assertInstanceOf(TwigFunction::class, $function);
40
            $this->assertIsCallable($function->getCallable());
41
        }
42
    }
43
44
    public function testRenderTracker(): void
45
    {
46
        $this->environment->render('@Core23Matomo/tracker_code.html.twig', [
47
            'site_id'       => 13,
48
            'matomo_host'   => 'localhost',
49
            'cookie_domain' => null,
50
        ])
51
            ->willReturn('HTML CONTENT')
52
        ;
53
54
        $extension = new MatomoTwigExtension($this->environment->reveal());
55
56
        $this->assertSame('HTML CONTENT', $extension->renderTracker([
57
            'site_id' => 13,
58
        ]));
59
    }
60
61
    public function testRenderTrackerWithoutSiteId(): void
62
    {
63
        $extension = new MatomoTwigExtension($this->environment->reveal());
64
65
        $this->environment->render(Argument::any())
66
            ->shouldNotBeCalled()
67
        ;
68
69
        $this->assertSame('', $extension->renderTracker());
70
    }
71
}
72