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 ( d0468e...1b9a97 )
by
unknown
15s queued 11s
created

MatomoTrackerBlockServiceTest::testGetMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
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 Core23\MatomoBundle\Tests\Block\Service;
13
14
use Core23\MatomoBundle\Block\Service\MatomoTrackerBlockService;
15
use Sonata\BlockBundle\Block\BlockContext;
16
use Sonata\BlockBundle\Form\Mapper\FormMapper;
17
use Sonata\BlockBundle\Model\Block;
18
use Sonata\BlockBundle\Model\BlockInterface;
19
use Sonata\BlockBundle\Test\BlockServiceTestCase;
20
21
final class MatomoTrackerBlockServiceTest extends BlockServiceTestCase
22
{
23
    public function testExecute(): void
24
    {
25
        $block = new Block();
26
27
        $blockContext = new BlockContext($block, [
28
            'host'        => null,
29
            'site'        => null,
30
            'domaintitle' => false,
31
            'donottrack'  => false,
32
            'nocookies'   => false,
33
            'template'    => '@Core23Matomo/Block/block_matomo_tracker.html.twig',
34
        ]);
35
36
        $blockService = new MatomoTrackerBlockService('block.service', $this->templating);
37
        $blockService->execute($blockContext);
38
39
        static::assertSame('@Core23Matomo/Block/block_matomo_tracker.html.twig', $this->templating->view);
40
41
        static::assertSame($blockContext, $this->templating->parameters['context']);
42
        static::assertIsArray($this->templating->parameters['settings']);
43
        static::assertInstanceOf(BlockInterface::class, $this->templating->parameters['block']);
44
    }
45
46
    public function testDefaultSettings(): void
47
    {
48
        $blockService = new MatomoTrackerBlockService('block.service', $this->templating);
49
        $blockContext = $this->getBlockContext($blockService);
50
51
        $this->assertSettings([
52
            'host'        => null,
53
            'site'        => null,
54
            'domaintitle' => false,
55
            'donottrack'  => false,
56
            'nocookies'   => false,
57
            'template'    => '@Core23Matomo/Block/block_matomo_tracker.html.twig',
58
        ], $blockContext);
59
    }
60
61
    public function testGetMetadata(): void
62
    {
63
        $blockService = new MatomoTrackerBlockService('block.service', $this->templating);
64
65
        $metadata = $blockService->getMetadata();
66
67
        static::assertSame('block.service', $metadata->getTitle());
68
        static::assertNotNull($metadata->getImage());
69
        static::assertStringStartsWith('data:image/png;base64,', $metadata->getImage() ?? '');
70
        static::assertSame('Core23MatomoBundle', $metadata->getDomain());
71
        static::assertSame([
72
            'class' => 'fa fa-code',
73
        ], $metadata->getOptions());
74
    }
75
76
    public function testConfigureEditForm(): void
77
    {
78
        $blockService = new MatomoTrackerBlockService('block.service', $this->templating);
79
80
        $block = new Block();
81
82
        $formMapper = $this->createMock(FormMapper::class);
83
        $formMapper->expects(static::once())->method('add');
84
85
        $blockService->configureEditForm($formMapper, $block);
86
    }
87
}
88