mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 03:07:58 +00:00 
			
		
		
		
	Optimized menu
This commit is contained in:
		@@ -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.
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -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]);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,18 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace tests\Unit\Domain\FixtureManagement;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\TestCase;
 | 
			
		||||
use Infinito\Domain\FixtureManagement\FixtureSource\GuestUserFixtureSource;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
class GuestUserFixtureSourceTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function testSlugName(): void
 | 
			
		||||
    {
 | 
			
		||||
        $fixtureSource = new GuestUserFixtureSource();
 | 
			
		||||
        $this->assertNotEquals($fixtureSource->getName(), $fixtureSource::getSlug());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user