mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-16 20:30:09 -07:00
36 lines
950 B
PHP
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());
|
|
}
|
|
}
|