futtern/tests/Entity/MenuItemTest.php

31 lines
809 B
PHP
Raw Permalink Normal View History

2024-08-16 11:44:16 +00:00
<?php declare(strict_types=1);
namespace App\Tests\Entity;
use App\Entity\FoodVendor;
use App\Entity\MenuItem;
2024-09-15 20:11:42 +00:00
use DateTimeImmutable;
2024-08-16 11:44:16 +00:00
use PHPUnit\Framework\TestCase;
final class MenuItemTest extends TestCase
{
public function testMenuItem(): void
{
$item = new MenuItem;
$item->setName('Test');
$this->assertEquals('Test', $item->getName());
$vendor = new FoodVendor;
$vendor->setName('Test');
$item->setFoodVendor($vendor);
$this->assertEquals($vendor, $item->getFoodVendor());
$this->assertFalse($item->isDeleted());
2024-09-15 20:11:42 +00:00
$this->assertNull($item->getDeletedAt());
2024-08-16 11:44:16 +00:00
$item->delete();
$this->assertTrue($item->isDeleted());
2024-09-15 20:11:42 +00:00
$this->assertInstanceOf(DateTimeImmutable::class, $item->getDeletedAt());
2024-08-16 11:44:16 +00:00
}
}