. */ declare(strict_types=1); namespace App\Tests\Entity\Parts; use App\Entity\Parts\PartLot; use DateTime; use PHPUnit\Framework\TestCase; class PartLotTest extends TestCase { public function testIsExpired(): void { $lot = new PartLot(); $this->assertNull($lot->isExpired(), 'Lot must be return null when no Expiration date is set!'); $lot->setExpirationDate(new \DateTimeImmutable('+1 hour')); $this->assertFalse($lot->isExpired(), 'Lot with expiration date in the future must not be expired!'); $lot->setExpirationDate(new \DateTimeImmutable('-1 hour')); $this->assertTrue($lot->isExpired(), 'Lot with expiration date in the past must be expired!'); } }