mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Implemented testThatEveryEntityHasAPersistedLaw
This commit is contained in:
parent
02b2dfa9ae
commit
6126c96cbb
@ -43,7 +43,7 @@ class Right extends AbstractMeta implements RightInterface
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Law", inversedBy="rights")
|
||||
* @ORM\JoinColumn(name="law_id", referencedColumnName="id")
|
||||
* @ORM\JoinColumn(name="law_id", referencedColumnName="id",nullable=false)
|
||||
*
|
||||
* @var LawInterface
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace tests\Unit\Repository\Meta;
|
||||
namespace tests\Integration\Repository\Meta;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
@ -17,8 +17,11 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class RightRepositoryTest extends KernelTestCase
|
||||
class RightRepositoryIntegrationTest extends KernelTestCase
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const PRIORITY = 123;
|
||||
|
||||
/**
|
||||
@ -59,11 +62,11 @@ class RightRepositoryTest extends KernelTestCase
|
||||
$this->right->setCrud(CRUDType::READ);
|
||||
$this->law = new Law();
|
||||
$this->entityManager->persist($this->law);
|
||||
$this->right->setLaw($this->law);
|
||||
}
|
||||
|
||||
public function testCreation(): void
|
||||
{
|
||||
$this->right->setLaw($this->law);
|
||||
$this->entityManager->persist($this->right);
|
||||
$this->entityManager->flush();
|
||||
$rightId = $this->right->getId();
|
||||
@ -75,6 +78,14 @@ class RightRepositoryTest extends KernelTestCase
|
||||
$this->loadedRight = null;
|
||||
}
|
||||
|
||||
public function testThatEveryEntityHasAPersistedLaw(): void
|
||||
{
|
||||
foreach ($this->rightRepository->findAll() as $right) {
|
||||
$this->assertInstanceOf(LawInterface::class, $right->getLaw());
|
||||
$this->assertGreaterThan(0, $right->getLaw()->getId());
|
||||
}
|
||||
}
|
||||
|
||||
private function deleteRight(): void
|
||||
{
|
||||
$this->entityManager->remove($this->loadedRight);
|
Loading…
Reference in New Issue
Block a user