Completed
Pull Request — 2.x (#243)
by Grégoire
04:52
created

BaseBreadcrumbMenuBlockServiceTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructorLegacy() 0 13 1
A testItSInitializable() 0 19 1
1
<?php
2
namespace Sonata\SeoBundle\Tests\Block\Breadcrumb;
3
4
use Knp\Menu\FactoryInterface;
5
use Knp\Menu\Provider\MenuProviderInterface;
6
use PHPUnit\Framework\TestCase;
7
use Sonata\BlockBundle\Menu\MenuRegistryInterface;
8
use Sonata\SeoBundle\Block\Breadcrumb\BaseBreadcrumbMenuBlockService;
9
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
10
11
class BaseBreadcrumbMenuBlockServiceTest extends TestCase
12
{
13
    /**
14
     * @group legacy
15
     * @expectedDeprecation Calling "Sonata\SeoBundle\Block\Breadcrumb\BaseBreadcrumbMenuBlockService::__construct" without a "Sonata\BlockBundle\Menu\MenuRegistryInterface" argument is deprecated since 2.x and will no longer be possible in 3.0.
16
     */
17
    public function testConstructorLegacy()
18
    {
19
        $this->getMockForAbstractClass(
20
            BaseBreadcrumbMenuBlockService::class,
21
            [
22
                'my_context',
23
                'some name',
24
                $this->createMock(EngineInterface::class),
25
                $this->createMock(MenuProviderInterface::class),
26
                $this->createMock(FactoryInterface::class),
27
            ]
28
        );
29
    }
30
31
    public function testItSInitializable()
32
    {
33
        $this->assertInstanceOf(
34
            BaseBreadcrumbMenuBlockService::class,
35
            $blockService = $this->getMockForAbstractClass(
36
                BaseBreadcrumbMenuBlockService::class,
37
                [
38
                    'my_context',
39
                    'some name',
40
                    $this->createMock(EngineInterface::class),
41
                    $this->createMock(MenuProviderInterface::class),
42
                    $this->createMock(FactoryInterface::class),
43
                    $this->createMock(MenuRegistryInterface::class),
44
                ]
45
            )
46
        );
47
48
        $this->assertTrue($blockService->handleContext('my_context'));
49
    }
50
}
51