infinito/application/symfony/tests/Integration/Domain/Fixture/FixtureSourceFactoryIntegrationTest.php

79 lines
2.4 KiB
PHP
Raw Normal View History

2019-02-02 23:02:28 +01:00
<?php
namespace tests\Integration\Domain\Fixture;
2019-02-02 23:02:28 +01:00
use Infinito\Domain\Fixture\FixtureSource\FixtureSourceInterface;
2020-04-02 21:13:35 +02:00
use Infinito\Domain\Fixture\FixtureSourceFactory;
use Infinito\Entity\Source\SourceInterface;
2020-04-02 21:13:35 +02:00
use PHPUnit\Framework\TestCase;
2019-02-02 23:02:28 +01:00
/**
* @author kevinfrantz
*/
2019-03-31 16:59:46 +02:00
class FixtureSourceFactoryIntegrationTest extends TestCase
2019-02-02 23:02:28 +01:00
{
/**
* @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;
}
}
2019-03-31 16:59:46 +02:00
public function testFixtureSourcesIcons(): void
{
$icons = [];
foreach ($this->fixtureSources as $fixtureSource) {
$this->assertInstanceOf(FixtureSourceInterface::class, $fixtureSource);
$icon = $fixtureSource->getIcon();
$this->assertIsString($icon);
$this->assertFalse(in_array($icon, $icons), 'An icon has to be unique');
$icons[] = $icon;
}
}
2019-03-31 17:59:43 +02:00
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;
}
}
2019-03-31 16:59:46 +02:00
/**
* The following test is redundant.
*/
2019-02-02 23:02:28 +01:00
public function testFixtureSourcesObjects(): void
{
$objects = [];
foreach ($this->fixtureSources as $fixtureSource) {
$this->assertInstanceOf(SourceInterface::class, $fixtureSource->getORMReadyObject());
2019-03-31 16:59:46 +02:00
$this->assertFalse(in_array($fixtureSource, $objects), 'A object has to be unique');
2019-02-02 23:02:28 +01:00
$objects[] = $fixtureSource;
}
}
}