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

Skip to content

Commit 87c8561

Browse files
minor #32968 Use assertEqualsWithDelta when needed (jderusse)
This PR was merged into the 3.4 branch. Discussion ---------- Use assertEqualsWithDelta when needed | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32844 | License | MIT | Doc PR | NA This PR replaces deprecated paramèter `$delta` of methods `assertEquals` by the dedicated method `assertEqualsWithDelta` Commits ------- 3a0a901 Use assertEqualsWithDelta when required
2 parents 443e923 + 3a0a901 commit 87c8561

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/Symfony/Component/HttpFoundation/Tests/CookieTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function testGetExpiresTimeWithStringValue()
119119
$cookie = new Cookie('foo', 'bar', $value);
120120
$expire = strtotime($value);
121121

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

125125
public function testGetDomain()

src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ public function testParseTypeDouble($value, $expectedValue)
806806
{
807807
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
808808
$parsedValue = $formatter->parse($value, NumberFormatter::TYPE_DOUBLE);
809-
$this->assertEquals($expectedValue, $parsedValue, '', 0.001);
809+
$this->assertEqualsWithDelta($expectedValue, $parsedValue, 0.001);
810810
}
811811

812812
public function parseTypeDoubleProvider()

src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testDuration()
7373
$event->start();
7474
usleep(200000);
7575
$event->stop();
76-
$this->assertEquals(200, $event->getDuration(), '', self::DELTA);
76+
$this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
7777

7878
$event = new StopwatchEvent(microtime(true) * 1000);
7979
$event->start();
@@ -83,15 +83,15 @@ public function testDuration()
8383
$event->start();
8484
usleep(100000);
8585
$event->stop();
86-
$this->assertEquals(200, $event->getDuration(), '', self::DELTA);
86+
$this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
8787
}
8888

8989
public function testDurationBeforeStop()
9090
{
9191
$event = new StopwatchEvent(microtime(true) * 1000);
9292
$event->start();
9393
usleep(200000);
94-
$this->assertEquals(200, $event->getDuration(), '', self::DELTA);
94+
$this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
9595

9696
$event = new StopwatchEvent(microtime(true) * 1000);
9797
$event->start();
@@ -100,7 +100,7 @@ public function testDurationBeforeStop()
100100
usleep(50000);
101101
$event->start();
102102
usleep(100000);
103-
$this->assertEquals(100, $event->getDuration(), '', self::DELTA);
103+
$this->assertEqualsWithDelta(100, $event->getDuration(), self::DELTA);
104104
}
105105

106106
public function testStopWithoutStart()
@@ -132,7 +132,7 @@ public function testEnsureStopped()
132132
$event->start();
133133
usleep(100000);
134134
$event->ensureStopped();
135-
$this->assertEquals(300, $event->getDuration(), '', self::DELTA);
135+
$this->assertEqualsWithDelta(300, $event->getDuration(), self::DELTA);
136136
}
137137

138138
public function testStartTime()
@@ -149,7 +149,7 @@ public function testStartTime()
149149
$event->start();
150150
usleep(100000);
151151
$event->stop();
152-
$this->assertEquals(0, $event->getStartTime(), '', self::DELTA);
152+
$this->assertEqualsWithDelta(0, $event->getStartTime(), self::DELTA);
153153
}
154154

155155
public function testInvalidOriginThrowsAnException()

0 commit comments

Comments
 (0)