Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use assertEqualsWithDelta when needed #32968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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