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') |
|
|
|
|
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
|
|
|
|
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.