futtern/tests/Entity/MenuItemTest.php
lubiana 7674b6a6bd
All checks were successful
/ ls (pull_request) Successful in 2m13s
/ ls (push) Successful in 2m11s
add mutation testing
2024-09-17 17:55:33 +02:00

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());
}
}