FacebookLikeBoxBlockServiceTest::testService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 48

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 48
rs 9.1344
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\FacebookLikeBoxBlockService;
21
use Symfony\Component\OptionsResolver\OptionsResolver;
22
23
final class FacebookLikeBoxBlockServiceTest extends BlockServiceTestCase
24
{
25
    public function testService(): void
26
    {
27
        $service = new FacebookLikeBoxBlockService(
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
            'height' => 'height_setting',
37
            'colorscheme' => 'colorscheme_setting',
38
            'show_faces' => 'show_faces_setting',
39
            'show_header' => 'show_header_setting',
40
            'show_posts' => 'show_posts_setting',
41
            'show_border' => 'show_border_setting',
42
        ]);
43
44
        $optionResolver = new OptionsResolver();
45
        $service->configureSettings($optionResolver);
46
47
        $blockContext = new BlockContext($block, $optionResolver->resolve($block->getSettings()));
48
49
        $formMapper = $this->createMock(FormMapper::class, [], [], '', false);
50
        $formMapper->expects($this->exactly(2))->method('add');
51
52
        $service->configureCreateForm($formMapper, $block);
53
        $service->configureEditForm($formMapper, $block);
54
55
        $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...
56
            ->with('@SonataSeo/Block/block_facebook_like_box.html.twig', [
57
               'block' => $block,
58
               'settings' => [
59
                   'url' => 'url_setting',
60
                   'width' => 'width_setting',
61
                   'height' => 'height_setting',
62
                   'colorscheme' => 'colorscheme_setting',
63
                   'show_faces' => 'show_faces_setting',
64
                   'show_header' => 'show_header_setting',
65
                   'show_posts' => 'show_posts_setting',
66
                   'show_border' => 'show_border_setting',
67
                   'template' => '@SonataSeo/Block/block_facebook_like_box.html.twig',
68
               ],
69
            ]);
70
71
        $service->execute($blockContext);
72
    }
73
}
74