Skip to content

Commit b20d60a

Browse files
committed
Upgrade PHPUnit comparators
1 parent dd0446c commit b20d60a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tests/Comparator/Int64Comparator.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
use MongoDB\BSON\Int64;
66
use SebastianBergmann\Comparator\Comparator;
77
use SebastianBergmann\Comparator\ComparisonFailure;
8+
use SebastianBergmann\Exporter\Exporter;
89

910
use function is_numeric;
1011
use function sprintf;
1112

1213
class Int64Comparator extends Comparator
1314
{
14-
public function accepts($expected, $actual)
15+
public function accepts($expected, $actual): bool
1516
{
1617
// Only compare if either value is an Int64 and the other value is numeric
1718
return ($expected instanceof Int64 && $this->isComparable($actual))
@@ -24,16 +25,17 @@ public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = f
2425
return;
2526
}
2627

28+
$exporter = new Exporter();
29+
2730
throw new ComparisonFailure(
2831
$expected,
2932
$actual,
3033
'',
3134
'',
32-
false,
3335
sprintf(
3436
'Failed asserting that %s matches expected %s.',
35-
$this->exporter->export($actual),
36-
$this->exporter->export($expected),
37+
$exporter->export($actual),
38+
$exporter->export($expected),
3739
),
3840
);
3941
}

tests/Comparator/ServerComparator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class ServerComparator extends Comparator
1212
{
13-
public function accepts($expected, $actual)
13+
public function accepts($expected, $actual): bool
1414
{
1515
return $expected instanceof Server && $actual instanceof Server;
1616
}
@@ -26,7 +26,6 @@ public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = f
2626
$actual,
2727
'',
2828
'',
29-
false,
3029
sprintf(
3130
'Failed asserting that Server("%s:%d") matches expected Server("%s:%d").',
3231
$actual->getHost(),

0 commit comments

Comments
 (0)