diff --git a/tests/Doctrine/Tests/Models/DateTimeCompositeKey/Article.php b/tests/Doctrine/Tests/Models/DateTimeCompositeKey/Article.php index a7cc9ca2ece..6350c59084b 100644 --- a/tests/Doctrine/Tests/Models/DateTimeCompositeKey/Article.php +++ b/tests/Doctrine/Tests/Models/DateTimeCompositeKey/Article.php @@ -23,14 +23,18 @@ class Article #[Column] private string $title; + #[Column] + private string $content; + /** @var Collection */ #[OneToMany(targetEntity: ArticleAudit::class, mappedBy: 'article', cascade: ['ALL'])] private Collection $audit; - public function __construct(string $title) + public function __construct(string $title, string $content) { - $this->title = $title; - $this->audit = new ArrayCollection(); + $this->title = $title; + $this->content = $content; + $this->audit = new ArrayCollection(); } public function changeTitle(string $newTitle): void @@ -39,6 +43,12 @@ public function changeTitle(string $newTitle): void $this->updateAudit('title'); } + public function changeContent(string $newContent): void + { + $this->content = $newContent; + $this->updateAudit('content'); + } + public function getId(): ?int { return $this->id; @@ -57,6 +67,11 @@ public function getTitle(): string return $this->title; } + public function getContent(): string + { + return $this->content; + } + private function updateAudit(string $changedKey): void { $this->audit[] = new ArticleAudit( diff --git a/tests/Doctrine/Tests/ORM/Utility/IdentifierFlattenerDateTimeImmutableIdTest.php b/tests/Doctrine/Tests/ORM/Utility/IdentifierFlattenerDateTimeImmutableIdTest.php index 6cf2cf8bc98..7e6954786ec 100644 --- a/tests/Doctrine/Tests/ORM/Utility/IdentifierFlattenerDateTimeImmutableIdTest.php +++ b/tests/Doctrine/Tests/ORM/Utility/IdentifierFlattenerDateTimeImmutableIdTest.php @@ -12,7 +12,6 @@ use Doctrine\Tests\OrmFunctionalTestCase; use function dirname; -use function sleep; /** * Test the IdentifierFlattener utility class @@ -48,10 +47,9 @@ protected function setUp(): void /** @group utilities */ public function testFlattenIdentifierWithDateTimeId(): void { - $article = new Article('Some title'); + $article = new Article('Some title', 'Lorem ipsum'); $article->changeTitle('New title'); - sleep(1); - $article->changeTitle('Newest title'); + $article->changeContent('Lorem ipsum dolor sit amet'); $this->storeEntities($article); @@ -66,7 +64,7 @@ public function testFlattenIdentifierWithDateTimeId(): void /** @group utilities */ public function testFindEntityWithCompositeId(): void { - $article = new Article('Some title'); + $article = new Article('Some title', 'Lorem ipsum'); $fakeAudit = new ArticleAudit( $timestamp = new DateTimeImmutable('2022-03-02'), 'title',