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

testItSInitializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
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