2024-08-16 11:44:16 +00:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Tests\Entity;
|
|
|
|
|
|
|
|
use App\Entity\FoodOrder;
|
|
|
|
use App\Entity\OrderItem;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
final class FoodOrderTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testFoodOrder(): void
|
|
|
|
{
|
|
|
|
$order = new FoodOrder;
|
|
|
|
$orderItem = new OrderItem;
|
|
|
|
$this->assertCount(0, $order->getOrderItems());
|
|
|
|
$order->addOrderItem($orderItem);
|
|
|
|
$order->addOrderItem($orderItem);
|
|
|
|
$this->assertCount(1, $order->getOrderItems());
|
2024-09-15 20:11:42 +00:00
|
|
|
$this->assertSame($order, $orderItem->getFoodOrder());
|
2024-08-16 11:44:16 +00:00
|
|
|
$order->removeOrderItem($orderItem);
|
|
|
|
$this->assertCount(0, $order->getOrderItems());
|
2024-09-15 20:11:42 +00:00
|
|
|
$this->assertNull($orderItem->getFoodOrder());
|
2024-08-16 11:44:16 +00:00
|
|
|
}
|
|
|
|
}
|