TwitterEmbedTweetBlockServiceTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testBuildUri() 0 16 1
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\Test\BlockServiceTestCase;
17
use Sonata\SeoBundle\Block\Social\TwitterEmbedTweetBlockService;
18
use Sonata\SeoBundle\Tests\Fixtures\Block\TwitterEmbedTweetBSTest;
19
use Twig\Environment;
20
21
/**
22
 * @author Hugo Briand <[email protected]>
23
 */
24
final class TwitterEmbedTweetBlockServiceTest extends BlockServiceTestCase
25
{
26
    public function testBuildUri(): void
27
    {
28
        $settings = [
29
            'tweet' => 'tweeeeeeeet',
30
            'foo' => 'bar',
31
            'align' => 'bar',
32
        ];
33
34
        $expected = sprintf('%s?%s', TwitterEmbedTweetBlockService::TWITTER_OEMBED_URI, 'align=bar&url=tweeeeeeeet');
35
36
        $blockService = new TwitterEmbedTweetBSTest($this->createMock(Environment::class));
37
        $this->assertSame($expected, $blockService->publicBuildUri(true, $settings));
38
39
        $expected = sprintf('%s?%s', TwitterEmbedTweetBlockService::TWITTER_OEMBED_URI, 'align=bar&id=tweeeeeeeet');
40
        $this->assertSame($expected, $blockService->publicBuildUri(false, $settings));
41
    }
42
}
43