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 ( 1a1c3b...c9508c )
by
unknown
25s
created

ShariffShareBlockServiceTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 6
dl 0
loc 71
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testDefaultSettings() 0 16 1
A testExecute() 0 24 1
A testGetMetadata() 0 14 1
A testConfigureEditForm() 0 11 1
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\ShariffBundle\Tests\Block\Service;
13
14
use Core23\ShariffBundle\Block\Service\ShariffShareBlockService;
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 ShariffShareBlockServiceTest extends BlockServiceTestCase
22
{
23
    public function testDefaultSettings(): void
24
    {
25
        $blockService = new ShariffShareBlockService('block.service', $this->templating);
26
        $blockContext = $this->getBlockContext($blockService);
27
28
        $this->assertSettings([
29
            'url'            => null,
30
            'class'          => null,
31
            'services'       => ['twitter', 'facebook', 'googleplus'],
32
            'theme'          => 'standard',
33
            'orientation'    => 'horizontal',
34
            'flattrUser'     => null,
35
            'flattrCategory' => null,
36
            'template'       => '@Core23Shariff/Block/block_shariff.html.twig',
37
        ], $blockContext);
38
    }
39
40
    public function testExecute(): void
41
    {
42
        $block = new Block();
43
44
        $blockContext = new BlockContext($block, [
45
            'url'            => null,
46
            'class'          => null,
47
            'services'       => ['twitter', 'facebook', 'googleplus'],
48
            'theme'          => 'standard',
49
            'orientation'    => 'horizontal',
50
            'flattrUser'     => null,
51
            'flattrCategory' => null,
52
            'template'       => '@Core23Shariff/Block/block_shariff.html.twig',
53
        ]);
54
55
        $blockService = new ShariffShareBlockService('block.service', $this->templating);
56
        $blockService->execute($blockContext);
57
58
        static::assertSame('@Core23Shariff/Block/block_shariff.html.twig', $this->templating->view);
59
60
        static::assertSame($blockContext, $this->templating->parameters['context']);
61
        static::assertIsArray($this->templating->parameters['settings']);
62
        static::assertInstanceOf(BlockInterface::class, $this->templating->parameters['block']);
63
    }
64
65
    public function testGetMetadata(): void
66
    {
67
        $blockService = new ShariffShareBlockService('block.service', $this->templating);
68
69
        $metadata = $blockService->getMetadata();
70
71
        static::assertSame('block.service', $metadata->getTitle());
72
        static::assertNotNull($metadata->getImage());
73
        static::assertStringStartsWith('data:image/png;base64,', $metadata->getImage() ?? '');
74
        static::assertSame('Core23ShariffBundle', $metadata->getDomain());
75
        static::assertSame([
76
            'class' => 'fa fa-share-square-o',
77
        ], $metadata->getOptions());
78
    }
79
80
    public function testConfigureEditForm(): void
81
    {
82
        $blockService = new ShariffShareBlockService('block.service', $this->templating);
83
84
        $block = new Block();
85
86
        $formMapper = $this->createMock(FormMapper::class);
87
        $formMapper->expects(static::once())->method('add');
88
89
        $blockService->configureEditForm($formMapper, $block);
90
    }
91
}
92