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

36 lines
940 B
PHP

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