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 ( 9338f4...d828eb )
by Christian
01:36
created

ShariffShareBlockServiceTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 5
dl 0
loc 56
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testDefaultSettings() 0 16 1
A testExecute() 0 24 1
A testBuildEditForm() 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\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 ShariffShareBlockServiceTest extends AbstractBlockServiceTestCase
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
        $this->assertSame('@Core23Shariff/Block/block_shariff.html.twig', $this->templating->view);
59
60
        $this->assertSame($blockContext, $this->templating->parameters['context']);
61
        $this->assertInternalType('array', $this->templating->parameters['settings']);
62
        $this->assertInstanceOf(BlockInterface::class, $this->templating->parameters['block']);
63
    }
64
65
    public function testBuildEditForm(): void
66
    {
67
        $blockService = new ShariffShareBlockService('block.service', $this->templating);
68
69
        $block = new Block();
70
71
        $formMapper = $this->createMock(FormMapper::class);
72
        $formMapper->expects($this->once())->method('add');
73
74
        $blockService->buildEditForm($formMapper, $block);
75
    }
76
}
77