lint
All checks were successful
/ ls (pull_request) Successful in 37s
/ ls (push) Successful in 35s

This commit is contained in:
Jonas 2024-08-16 11:15:23 +02:00
parent 6f23c3c1b7
commit 2a28465626
Signed by: lubiana
SSH key fingerprint: SHA256:gkqM8DUX4Blf6P52fycW8ISTd+4eAHH+Uzu9iyc8hAM
3 changed files with 6 additions and 12 deletions

View file

@ -67,15 +67,10 @@ class FoodOrder
public function isClosed(): bool
{
if ($this->closedAt === null) {
if (! $this->closedAt instanceof DateTimeImmutable) {
return false;
}
if ($this->closedAt < new DateTimeImmutable) {
return true;
}
return false;
return $this->closedAt < new DateTimeImmutable;
}
public function close(): static

View file

@ -192,7 +192,6 @@ final class FoodOrderControllerTest extends DbWebTest
$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());
@ -209,7 +208,6 @@ final class FoodOrderControllerTest extends DbWebTest
$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());

View file

@ -8,6 +8,7 @@ use App\Entity\MenuItem;
use App\Entity\OrderItem;
use App\Repository\MenuItemRepository;
use App\Tests\DbWebTest;
use DateTimeImmutable;
use Override;
use function sprintf;
@ -66,7 +67,7 @@ final class OrderItemControllerTest extends DbWebTest
public function testNewOrderClosed(): void
{
$this->order->setClosedAt(new \DateTimeImmutable('-1 Hour'));
$this->order->setClosedAt(new DateTimeImmutable('-1 Hour'));
$this->manager->persist($this->order);
$this->manager->flush();
@ -172,7 +173,6 @@ final class OrderItemControllerTest extends DbWebTest
self::assertSame(1, $this->repository->count([]));
self::assertSame(2, $this->menuItemRepository->count([]));
}
public function testEditOrderClosed(): void
@ -182,13 +182,14 @@ final class OrderItemControllerTest extends DbWebTest
$orderItem->setExtras('My Extra');
$orderItem->setFoodOrder($this->order);
$orderItem->setMenuItem($this->menuItem);
$this->order->close();
$this->manager->persist($orderItem);
$this->manager->persist($this->order);
$this->manager->flush();
$crawler = $this->client->request('GET', sprintf('%s%s/edit', $this->path, $orderItem->getId()));
$this->client->request('GET', sprintf('%s%s/edit', $this->path, $orderItem->getId()));
self::assertResponseRedirects(sprintf('/food/order/%s', $this->order->getId()));
}