-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathMenuBuilderTest.php
More file actions
45 lines (36 loc) · 1.29 KB
/
MenuBuilderTest.php
File metadata and controls
45 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Tests\Sylius\AdminUi\Unit\Knp\Menu;
use Knp\Menu\FactoryInterface;
use Knp\Menu\MenuItem;
use PHPUnit\Framework\TestCase;
use Sylius\AdminUi\Knp\Menu\Event\MenuBuilderEvent;
use Sylius\AdminUi\Knp\Menu\MenuBuilder;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
final class MenuBuilderTest extends TestCase
{
public function testItCreatesMenuRootAndThrowsEvent(): void
{
$factory = $this->createMock(FactoryInterface::class);
$eventDispatcher = $this->createMock(EventDispatcherInterface::class);
$menuBuilder = new MenuBuilder($factory, $eventDispatcher);
$root = new MenuItem('root', $factory);
$factory
->expects($this->once())
->method('createItem')
->with('root')
->willReturn($root)
;
$event = new MenuBuilderEvent($factory, $root);
$eventDispatcher->expects($this->once())->method('dispatch')->with($event, 'sylius_admin_ui.menu.event.main');
self::assertSame($root, $menuBuilder->createMenu([]));
}
}