Skip to content

Commit

Permalink
Modify test for code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
JDruery committed Oct 30, 2023
1 parent 1e3f23f commit fad0036
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions tests/Gedmo/Tree/Issue/Issue2652Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,22 @@ protected function setUp(): void
$evm->addEventSubscriber($this->listener);

$this->getDefaultMockSqliteEntityManager($evm);
$this->populate();
}

public function testAddMultipleEntityTypes(): void
{
$food = new Category();
$food->setTitle('Food');
$this->em->persist($food);

$monkey = new Category2();
$monkey->setTitle('Monkey');
$this->em->persist($monkey);

// Before issue #2652 was fixed, null values would be inserted into the closure table at this next line and an exception would be thrown
$this->em->flush();

// Ensure that the closures were correctly inserted
$repo = $this->em->getRepository(self::CATEGORY);

$food = $repo->findOneBy(['title' => 'Food']);
Expand Down Expand Up @@ -83,17 +94,4 @@ protected function getUsedEntityFixtures(): array
self::CLOSURE2,
];
}

private function populate(): void
{
$food = new Category();
$food->setTitle('Food');
$this->em->persist($food);

$monkey = new Category2();
$monkey->setTitle('Monkey');
$this->em->persist($monkey);

$this->em->flush();
}
}

0 comments on commit fad0036

Please sign in to comment.