2019-02-02 23:02:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace tests\Integration\Domain\FixtureManagement;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Domain\FixtureManagement\FixtureSourceFactory;
|
|
|
|
use Infinito\Domain\FixtureManagement\FixtureSource\FixtureSourceInterface;
|
|
|
|
use Infinito\Entity\Source\SourceInterface;
|
2019-02-02 23:02:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class FixtureSourceFactoryTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var array|FixtureSourceInterface[]
|
|
|
|
*/
|
|
|
|
protected $fixtureSources;
|
|
|
|
|
2019-02-12 18:04:36 +01:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
|
|
|
* @see \PHPUnit\Framework\TestCase::setUp()
|
|
|
|
*/
|
2019-02-02 23:02:28 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|