From 428b71b859bf4f995908920ff4d141a4cf440306 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 28 Jul 2026 14:31:02 +0200 Subject: [PATCH] test(version-check): Fix flaky test Signed-off-by: Joas Schilling --- tests/lib/Updater/VersionCheckTest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php index d8bce8118987d..bd809a8c3dfe7 100644 --- a/tests/lib/Updater/VersionCheckTest.php +++ b/tests/lib/Updater/VersionCheckTest.php @@ -65,6 +65,7 @@ private function buildUpdateUrl(string $baseUrl, int $lastUpdateDate): string { } public function testCheckInCache(): void { + $time = time(); $expectedResult = [ 'version' => '8.0.4.2', 'versionstring' => 'ownCloud 8.0.4', @@ -82,7 +83,7 @@ public function testCheckInCache(): void { ->expects($this->once()) ->method('getValueInt') ->with('core', 'lastupdatedat') - ->willReturn(time()); + ->willReturn($time); $this->config ->expects($this->once()) ->method('getAppValue') @@ -283,7 +284,7 @@ public function testCheckWithEmptyInvalidXmlResponse(): void { ->with('core', 'lastupdatedat') ->willReturnOnConsecutiveCalls( 0, - time(), + $lastUpdateDate, ); $this->config ->expects($this->exactly(2)) @@ -298,7 +299,7 @@ public function testCheckWithEmptyInvalidXmlResponse(): void { $this->appConfig ->expects($this->once()) ->method('setValueInt') - ->with('core', 'lastupdatedat', time()); + ->with('core', 'lastupdatedat', $lastUpdateDate); $this->config ->expects($this->once()) ->method('setAppValue')