init
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\Translation\Test\Unit\Model\Entity;
|
||||
|
||||
use Esun\Translation\Api\TranslatableEntityInterface;
|
||||
use Esun\Translation\Model\Entity\EntityPool;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EntityPoolTest extends TestCase
|
||||
{
|
||||
public function testItReturnsConfiguredEntity(): void
|
||||
{
|
||||
$entity = $this->createMock(TranslatableEntityInterface::class);
|
||||
$pool = new EntityPool(['cms_page' => $entity]);
|
||||
|
||||
self::assertSame($entity, $pool->get('cms_page'));
|
||||
self::assertSame(['cms_page'], $pool->getTypes());
|
||||
}
|
||||
|
||||
public function testItRejectsUnsupportedEntityType(): void
|
||||
{
|
||||
$pool = new EntityPool();
|
||||
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Unsupported translation entity type "unknown".');
|
||||
|
||||
$pool->get('unknown');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user