30 lines
809 B
PHP
30 lines
809 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Tests\Entity;
|
|
|
|
use App\Entity\FoodVendor;
|
|
use App\Entity\MenuItem;
|
|
use DateTimeImmutable;
|
|
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());
|
|
$this->assertNull($item->getDeletedAt());
|
|
$item->delete();
|
|
$this->assertTrue($item->isDeleted());
|
|
$this->assertInstanceOf(DateTimeImmutable::class, $item->getDeletedAt());
|
|
}
|
|
}
|