Skip to content

Commit

Permalink
Use assertEqualsWithDelta when required
Browse files Browse the repository at this point in the history
  • Loading branch information
jderusse committed Aug 5, 2019
1 parent b131278 commit 3a0a901
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function testGetExpiresTimeWithStringValue()
$cookie = new Cookie('foo', 'bar', $value);
$expire = strtotime($value);

$this->assertEquals($expire, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date', 1);
$this->assertEqualsWithDelta($expire, $cookie->getExpiresTime(), 1, '->getExpiresTime() returns the expire date');
}

public function testGetDomain()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ public function testParseTypeDouble($value, $expectedValue)
{
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$parsedValue = $formatter->parse($value, NumberFormatter::TYPE_DOUBLE);
$this->assertEquals($expectedValue, $parsedValue, '', 0.001);
$this->assertEqualsWithDelta($expectedValue, $parsedValue, 0.001);
}

public function parseTypeDoubleProvider()
Expand Down
12 changes: 6 additions & 6 deletions src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testDuration()
$event->start();
usleep(200000);
$event->stop();
$this->assertEquals(200, $event->getDuration(), '', self::DELTA);
$this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);

$event = new StopwatchEvent(microtime(true) * 1000);
$event->start();
Expand All @@ -83,15 +83,15 @@ public function testDuration()
$event->start();
usleep(100000);
$event->stop();
$this->assertEquals(200, $event->getDuration(), '', self::DELTA);
$this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
}

public function testDurationBeforeStop()
{
$event = new StopwatchEvent(microtime(true) * 1000);
$event->start();
usleep(200000);
$this->assertEquals(200, $event->getDuration(), '', self::DELTA);
$this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);

$event = new StopwatchEvent(microtime(true) * 1000);
$event->start();
Expand All @@ -100,7 +100,7 @@ public function testDurationBeforeStop()
usleep(50000);
$event->start();
usleep(100000);
$this->assertEquals(100, $event->getDuration(), '', self::DELTA);
$this->assertEqualsWithDelta(100, $event->getDuration(), self::DELTA);
}

public function testStopWithoutStart()
Expand Down Expand Up @@ -132,7 +132,7 @@ public function testEnsureStopped()
$event->start();
usleep(100000);
$event->ensureStopped();
$this->assertEquals(300, $event->getDuration(), '', self::DELTA);
$this->assertEqualsWithDelta(300, $event->getDuration(), self::DELTA);
}

public function testStartTime()
Expand All @@ -149,7 +149,7 @@ public function testStartTime()
$event->start();
usleep(100000);
$event->stop();
$this->assertEquals(0, $event->getStartTime(), '', self::DELTA);
$this->assertEqualsWithDelta(0, $event->getStartTime(), self::DELTA);
}

public function testInvalidOriginThrowsAnException()
Expand Down

0 comments on commit 3a0a901

Please sign in to comment.