Fix failing randomly test

This commit is contained in:
Nicolas Lœuillet 2023-07-26 16:01:22 +02:00
parent 90631abe46
commit 5fe5551972

View file

@ -237,14 +237,18 @@ class FeedControllerTest extends WallabagCoreTestCase
$entry1->setCreatedAt($day1); $entry1->setCreatedAt($day1);
$entry4->setCreatedAt($day2); $entry4->setCreatedAt($day2);
$property = (new \ReflectionObject($entry1))->getProperty('updatedAt');
$property->setAccessible(true);
$property->setValue($entry1, $day4);
$property = (new \ReflectionObject($entry4))->getProperty('updatedAt'); $property = (new \ReflectionObject($entry4))->getProperty('updatedAt');
$property->setAccessible(true); $property->setAccessible(true);
$property->setValue($entry4, $day3); $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(); $em->flush();
$client = $this->getTestClient(); $client = $this->getTestClient();