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 ( 0b86be...b9c831 )
by Christian
01:14
created

MatomoTrackerBlockServiceTest::testBuildEditForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
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\AdminBundle\Form\FormMapper;
16
use Sonata\BlockBundle\Block\BlockContext;
17
use Sonata\BlockBundle\Model\Block;
18
use Sonata\BlockBundle\Model\BlockInterface;
19
use Sonata\BlockBundle\Test\AbstractBlockServiceTestCase;
20
21
final class MatomoTrackerBlockServiceTest extends AbstractBlockServiceTestCase
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
        $this->assertSame('@Core23Matomo/Block/block_matomo_tracker.html.twig', $this->templating->view);
40
41
        $this->assertSame($blockContext, $this->templating->parameters['context']);
42
        $this->assertInternalType('array', $this->templating->parameters['settings']);
43
        $this->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 testBuildEditForm(): void
62
    {
63
        $blockService = new MatomoTrackerBlockService('block.service', $this->templating);
64
65
        $block = new Block();
66
67
        $formMapper = $this->createMock(FormMapper::class);
68
        $formMapper->expects($this->once())->method('add');
69
70
        $blockService->buildEditForm($formMapper, $block);
71
    }
72
}
73