FacebookLikeButtonBlockServiceTest::testService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 46

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 9.1781
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\SeoBundle\Tests\Block\Social;
15
16
use Sonata\BlockBundle\Block\BlockContext;
17
use Sonata\BlockBundle\Form\Mapper\FormMapper;
18
use Sonata\BlockBundle\Model\Block;
19
use Sonata\BlockBundle\Test\BlockServiceTestCase;
20
use Sonata\SeoBundle\Block\Social\FacebookLikeButtonBlockService;
21
use Symfony\Component\OptionsResolver\OptionsResolver;
22
23
final class FacebookLikeButtonBlockServiceTest extends BlockServiceTestCase
24
{
25
    public function testService(): void
26
    {
27
        $service = new FacebookLikeButtonBlockService(
28
            $this->twig
29
        );
30
31
        $block = new Block();
32
        $block->setType('core.text');
33
        $block->setSettings([
34
            'url' => 'url_setting',
35
            'width' => 'width_setting',
36
            'show_faces' => 'show_faces_setting',
37
            'share' => 'share_setting',
38
            'layout' => 'layout_setting',
39
            'colorscheme' => 'colorscheme_setting',
40
            'action' => 'action_setting',
41
        ]);
42
43
        $optionResolver = new OptionsResolver();
44
        $service->configureSettings($optionResolver);
45
46
        $blockContext = new BlockContext($block, $optionResolver->resolve($block->getSettings()));
47
48
        $formMapper = $this->createMock(FormMapper::class, [], [], '', false);
49
        $formMapper->expects($this->exactly(2))->method('add');
50
51
        $service->configureCreateForm($formMapper, $block);
52
        $service->configureEditForm($formMapper, $block);
53
54
        $this->twig->expects($this->once())->method('render')
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Twig\Environment>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
55
            ->with('@SonataSeo/Block/block_facebook_like_button.html.twig', [
56
               'block' => $block,
57
               'settings' => [
58
                   'url' => 'url_setting',
59
                   'width' => 'width_setting',
60
                   'show_faces' => 'show_faces_setting',
61
                   'share' => 'share_setting',
62
                   'layout' => 'layout_setting',
63
                   'colorscheme' => 'colorscheme_setting',
64
                   'action' => 'action_setting',
65
                   'template' => '@SonataSeo/Block/block_facebook_like_button.html.twig',
66
               ],
67
            ]);
68
69
        $service->execute($blockContext);
70
    }
71
}
72