diff --git a/tests/Unit/CapiRemediationTest.php b/tests/Unit/CapiRemediationTest.php index 6b00818..7e6ac75 100644 --- a/tests/Unit/CapiRemediationTest.php +++ b/tests/Unit/CapiRemediationTest.php @@ -1349,12 +1349,12 @@ public function testRefreshDecisions($cacheType) $cachedValue[1][0] ); $lastPullItem = $remediation->getCacheStorage()->getItem($lastPullCacheKey); - - $this->assertEquals( - [AbstractCache::INDEX_EXP => $listExpiration, AbstractCache::LAST_PULL => $time], - $lastPullItem->get(), - 'Expiration and pull date should not have change' - ); + $lastPullItemContent = $lastPullItem->get(); + // Expiration and pull date should not have change + // Avoid false positive with tme manipulation (strict equality sometimes leads to error of 1 second) + $this->assertTrue($lastPullItemContent[AbstractCache::INDEX_EXP] <= $listExpiration && $listExpiration - 1 <= $lastPullItemContent[1]); + $this->assertTrue($lastPullItemContent[AbstractCache::LAST_PULL] <= $time && $time - 1 <= + $lastPullItemContent['last_pull']); // Test 13 : new + list again // We wait to test that expiration and pull date won't change $result = $remediation->refreshDecisions();