Completed
Push — master ( 2cf16b...bf4a2d )
by Jordi Sala
13:35 queued 22s
created

Social/FacebookSendButtonBlockServiceTest.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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\FacebookSendButtonBlockService;
21
use Symfony\Component\OptionsResolver\OptionsResolver;
22
23
final class FacebookSendButtonBlockServiceTest extends BlockServiceTestCase
24
{
25
    public function testService(): void
26
    {
27
        $service = new FacebookSendButtonBlockService(
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
        ]);
39
40
        $optionResolver = new OptionsResolver();
41
        $service->configureSettings($optionResolver);
42
43
        $blockContext = new BlockContext($block, $optionResolver->resolve($block->getSettings()));
44
45
        $formMapper = $this->createMock(FormMapper::class, [], [], '', false);
46
        $formMapper->expects($this->exactly(2))->method('add');
47
48
        $service->configureCreateForm($formMapper, $block);
49
        $service->configureEditForm($formMapper, $block);
50
51
        $this->twig->expects($this->once())->method('render')
0 ignored issues
show
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...
52
            ->with('@SonataSeo/Block/block_facebook_send_button.html.twig', [
53
               'block' => $block,
54
               'settings' => [
55
                   'url' => 'url_setting',
56
                   'width' => 'width_setting',
57
                   'height' => 'height_setting',
58
                   'colorscheme' => 'colorscheme_setting',
59
                   'template' => '@SonataSeo/Block/block_facebook_send_button.html.twig',
60
               ],
61
            ]);
62
63
        $service->execute($blockContext);
64
    }
65
}
66