improve test coverage
All checks were successful
/ ls (pull_request) Successful in 39s

This commit is contained in:
lubiana 2024-08-16 11:14:41 +02:00
parent a4f62868fd
commit 6f23c3c1b7
No known key found for this signature in database
3 changed files with 132 additions and 2 deletions

View file

@ -182,6 +182,40 @@ final class FoodOrderControllerTest extends DbWebTest
self::assertSame(1, $this->repository->count([]));
}
public function testOpen(): void
{
$order = new FoodOrder;
$order->setFoodVendor($this->vendor);
$order->close();
$this->assertTrue($order->isClosed());
$this->manager->persist($order);
$this->manager->flush();
$this->client->request('GET', sprintf('%s%s/open', $this->path, $order->getId()));
self::assertResponseRedirects("{$this->path}{$order->getId()}");
$openOrder = $this->repository->find($order->getId());
$this->assertFalse($openOrder->isClosed());
}
public function testClose(): void
{
$order = new FoodOrder;
$order->setClosedAt();
$order->setFoodVendor($this->vendor);
$this->assertFalse($order->isClosed());
$this->manager->persist($order);
$this->manager->flush();
$this->client->request('GET', sprintf('%s%s/close', $this->path, $order->getId()));
self::assertResponseRedirects("{$this->path}{$order->getId()}");
$openOrder = $this->repository->find($order->getId());
$this->assertTrue($openOrder->isClosed());
}
private function generatePaginatedOrders(): void
{
foreach (range(1, 35) as $i) {