Completed
Pull Request — 2.x (#243)
by Grégoire
03:24
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
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\SeoBundle\Tests\Block\Breadcrumb;
13
14
use Knp\Menu\FactoryInterface;
15
use Knp\Menu\Provider\MenuProviderInterface;
16
use PHPUnit\Framework\TestCase;
17
use Sonata\BlockBundle\Menu\MenuRegistryInterface;
18
use Sonata\SeoBundle\Block\Breadcrumb\BaseBreadcrumbMenuBlockService;
19
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
20
21
class BaseBreadcrumbMenuBlockServiceTest extends TestCase
22
{
23
    /**
24
     * @group legacy
25
     * @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.
26
     */
27
    public function testConstructorLegacy()
28
    {
29
        $this->getMockForAbstractClass(
30
            BaseBreadcrumbMenuBlockService::class,
31
            [
32
                'my_context',
33
                'some name',
34
                $this->createMock(EngineInterface::class),
35
                $this->createMock(MenuProviderInterface::class),
36
                $this->createMock(FactoryInterface::class),
37
            ]
38
        );
39
    }
40
41
    public function testItSInitializable()
42
    {
43
        $this->assertInstanceOf(
44
            BaseBreadcrumbMenuBlockService::class,
45
            $blockService = $this->getMockForAbstractClass(
46
                BaseBreadcrumbMenuBlockService::class,
47
                [
48
                    'my_context',
49
                    'some name',
50
                    $this->createMock(EngineInterface::class),
51
                    $this->createMock(MenuProviderInterface::class),
52
                    $this->createMock(FactoryInterface::class),
53
                    $this->createMock(MenuRegistryInterface::class),
54
                ]
55
            )
56
        );
57
58
        $this->assertTrue($blockService->handleContext('my_context'));
59
    }
60
}
61