2018-11-05 00:24:05 +01:00
|
|
|
<?php
|
2018-11-06 20:08:28 +01:00
|
|
|
|
2018-11-05 00:24:05 +01:00
|
|
|
namespace Tests\Unit\Entity\Subscriber;
|
|
|
|
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Subscriber\SourceMenuSubscriber;
|
2018-11-05 00:24:05 +01:00
|
|
|
use Symfony\Component\Translation\Translator;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Event\Menu\MenuEvent;
|
2018-11-05 00:24:05 +01:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use Symfony\Component\HttpFoundation\RequestStack;
|
2018-11-06 20:07:21 +01:00
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
use Knp\Menu\MenuItem;
|
|
|
|
use Knp\Menu\MenuFactory;
|
2018-11-05 00:24:05 +01:00
|
|
|
|
|
|
|
class SourceMenuSubscriberTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var SourceMenuSubscriber
|
|
|
|
*/
|
|
|
|
public $subscriber;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$translator = new Translator('en');
|
|
|
|
$this->subscriber = new SourceMenuSubscriber($translator);
|
|
|
|
}
|
2018-11-06 20:08:28 +01:00
|
|
|
|
|
|
|
public function testOnSourceMenuConfig(): void
|
|
|
|
{
|
2018-11-06 20:07:21 +01:00
|
|
|
$factory = new MenuFactory();
|
|
|
|
$item = new MenuItem('test', $factory);
|
|
|
|
$request = new Request();
|
|
|
|
$request->attributes->set('id', 123);
|
|
|
|
$requests = new RequestStack();
|
|
|
|
$requests->push($request);
|
|
|
|
$event = new MenuEvent($factory, $item, $requests);
|
2018-11-05 00:24:05 +01:00
|
|
|
$this->assertNull($this->subscriber->onSourceMenuConfigure($event));
|
|
|
|
}
|
|
|
|
}
|