From 5fe5551972d29a82f06248b4afd2a96a50a308c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 26 Jul 2023 16:01:22 +0200 Subject: [PATCH] Fix failing randomly test --- .../CoreBundle/Controller/FeedControllerTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php index 6f5c47c48..90e3feafe 100644 --- a/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php @@ -237,14 +237,18 @@ class FeedControllerTest extends WallabagCoreTestCase $entry1->setCreatedAt($day1); $entry4->setCreatedAt($day2); - $property = (new \ReflectionObject($entry1))->getProperty('updatedAt'); - $property->setAccessible(true); - $property->setValue($entry1, $day4); - $property = (new \ReflectionObject($entry4))->getProperty('updatedAt'); $property->setAccessible(true); $property->setValue($entry4, $day3); + // We have to flush and sleep here to be sure that $entry1 and $entry4 have different updatedAt values + $em->flush(); + sleep(2); + + $property = (new \ReflectionObject($entry1))->getProperty('updatedAt'); + $property->setAccessible(true); + $property->setValue($entry1, $day4); + $em->flush(); $client = $this->getTestClient();