From b02e25151f53685e6c81cc0bd71efd51ec1f6d23 Mon Sep 17 00:00:00 2001 From: Peter Gribanov Date: Tue, 27 Sep 2022 15:17:00 +0300 Subject: [PATCH] Correct compare float data --- src/Symfony/Component/Stopwatch/Tests/StopwatchPeriodTest.php | 2 +- src/Symfony/Component/Stopwatch/composer.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchPeriodTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchPeriodTest.php index e01849d474869..81010a79413fd 100644 --- a/src/Symfony/Component/Stopwatch/Tests/StopwatchPeriodTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchPeriodTest.php @@ -40,7 +40,7 @@ public function testGetEndTime($end, $useMorePrecision, $expected) public function testGetDuration($start, $end, $useMorePrecision, $duration) { $period = new StopwatchPeriod($start, $end, $useMorePrecision); - $this->assertSame($duration, $period->getDuration()); + $this->assertEqualsWithDelta($duration, $period->getDuration(), \PHP_FLOAT_EPSILON); } public function provideTimeValues() diff --git a/src/Symfony/Component/Stopwatch/composer.json b/src/Symfony/Component/Stopwatch/composer.json index 1babf15aed09f..a11dc7960f185 100644 --- a/src/Symfony/Component/Stopwatch/composer.json +++ b/src/Symfony/Component/Stopwatch/composer.json @@ -19,6 +19,9 @@ "php": ">=7.1.3", "symfony/service-contracts": "^1.0|^2" }, + "require-dev": { + "symfony/polyfill-php72": "~1.5" + }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" }, "exclude-from-classmap": [