mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-03 18:58:01 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace tests\Integration\Domain\FixtureManagement;
 | 
						|
 | 
						|
use PHPUnit\Framework\TestCase;
 | 
						|
use App\Domain\FixtureManagement\FixtureSourceFactory;
 | 
						|
use App\Domain\FixtureManagement\FixtureSource\FixtureSourceInterface;
 | 
						|
use App\Entity\Source\SourceInterface;
 | 
						|
 | 
						|
/**
 | 
						|
 * @author kevinfrantz
 | 
						|
 */
 | 
						|
class FixtureSourceFactoryTest extends TestCase
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * @var array|FixtureSourceInterface[]
 | 
						|
     */
 | 
						|
    protected $fixtureSources;
 | 
						|
 | 
						|
    /**
 | 
						|
     * {@inheritdoc}
 | 
						|
     *
 | 
						|
     * @see \PHPUnit\Framework\TestCase::setUp()
 | 
						|
     */
 | 
						|
    public function setUp(): void
 | 
						|
    {
 | 
						|
        $this->fixtureSources = FixtureSourceFactory::getAllFixtureSources();
 | 
						|
    }
 | 
						|
 | 
						|
    public function testFixtureSourcesSlugs(): void
 | 
						|
    {
 | 
						|
        $slugs = [];
 | 
						|
        foreach ($this->fixtureSources as $fixtureSource) {
 | 
						|
            $this->assertInstanceOf(FixtureSourceInterface::class, $fixtureSource);
 | 
						|
            $slug = $fixtureSource->getSlug();
 | 
						|
            $this->assertIsString($slug);
 | 
						|
            $this->assertFalse(in_array($slug, $slugs), 'A slug has to be unique');
 | 
						|
            $slugs[] = $slug;
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    public function testFixtureSourcesObjects(): void
 | 
						|
    {
 | 
						|
        $objects = [];
 | 
						|
        foreach ($this->fixtureSources as $fixtureSource) {
 | 
						|
            $this->assertInstanceOf(SourceInterface::class, $fixtureSource->getORMReadyObject());
 | 
						|
            $this->assertFalse(in_array($fixtureSource, $objects), 'A slug has to be unique');
 | 
						|
            $objects[] = $fixtureSource;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |