1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-17 12:50:08 -07:00
PrintABrick/tests/AppBundle/Repository/LDraw/KeywordRepositoryTest.php
2017-06-23 22:21:40 +02:00

36 lines
950 B
PHP

<?php
namespace Tests\AppBundle\Repository\LDraw;
use AppBundle\Entity\LDraw\Keyword;
use AppBundle\Repository\LDraw\KeywordRepository;
use Tests\AppBundle\BaseTest;
use Tests\AppBundle\Fixtures\LoadBaseData;
class KeywordRepositoryTest extends BaseTest
{
/** @var KeywordRepository */
private $repository;
public function setUp()
{
parent::setUp();
$this->setUpDb([LoadBaseData::class]);
$this->repository = $this->em->getRepository(Keyword::class);
}
public function testGetOrCreate()
{
$this->assertCount(0, $this->repository->findAll());
$keyword = $this->repository->getOrCreate('Keyword');
$this->repository->save($keyword);
$this->assertCount(1, $this->repository->findAll());
$keyword = $this->repository->getOrCreate('Keyword');
$this->repository->save($keyword);
$this->assertCount(1, $this->repository->findAll());
}
}