Optimized menu

This commit is contained in:
Kevin Frantz
2019-03-31 17:59:43 +02:00
parent 108debf6bf
commit 1aa5d35169
9 changed files with 129 additions and 17 deletions

View File

@@ -51,6 +51,18 @@ class FixtureSourceFactoryIntegrationTest extends TestCase
}
}
public function testFixtureSourceNames(): void
{
$names = [];
foreach ($this->fixtureSources as $fixtureSource) {
$this->assertInstanceOf(FixtureSourceInterface::class, $fixtureSource);
$name = $fixtureSource->getName();
$this->assertIsString($name);
$this->assertFalse(in_array($name, $names), 'An name has to be unique');
$names[] = $name;
}
}
/**
* The following test is redundant.
*/

View File

@@ -13,6 +13,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Role\Role;
use Infinito\Domain\FixtureManagement\FixtureSource\GuestUserFixtureSource;
/**
* @author kevinfrantz
@@ -79,7 +80,8 @@ class UserMenuSubscriberIntegrationTest extends KernelTestCase
$menuEvent = new MenuEvent($factory, $item, $requests);
$this->subscriber->onUserMenuConfigure($menuEvent);
$children = $menuEvent->getItem()->getChildren()['user']->getChildren();
$unauthentificatedItems = ['login', 'register'];
$guestUserName = (new GuestUserFixtureSource())->getName();
$unauthentificatedItems = ['login', 'register', $guestUserName];
foreach ($unauthentificatedItems as $key) {
$this->assertInstanceOf(MenuItem::class, $children[$key]);
}