Skip to content

Commit 0d9ce99

Browse files
committed
TestCase::exporter() is deprecated, use new Exporter
1 parent 9f59167 commit 0d9ce99

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/UnifiedSpecTests/Constraint/Matches.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use RuntimeException;
1414
use SebastianBergmann\Comparator\ComparisonFailure;
1515
use SebastianBergmann\Comparator\Factory;
16+
use SebastianBergmann\Exporter\Exporter;
1617

1718
use function array_keys;
1819
use function count;
@@ -82,14 +83,14 @@ public function evaluate($other, $description = '', $returnResult = false): ?boo
8283
} catch (RuntimeException $e) {
8384
/* This will generally catch internal errors from failAt(), which
8485
* include a key path to pinpoint the failure. */
86+
$exporter = new Exporter();
8587
$this->lastFailure = new ComparisonFailure(
8688
$this->value,
8789
$other,
8890
/* TODO: Improve the exporter to canonicalize documents by
8991
* sorting keys and remove spl_object_hash from output. */
90-
$this->exporter()->export($this->value),
91-
$this->exporter()->export($other),
92-
false,
92+
$exporter->export($this->value),
93+
$exporter->export($other),
9394
$e->getMessage(),
9495
);
9596
}
@@ -256,7 +257,7 @@ private function assertMatchesOperator(BSONDocument $operator, $actual, string $
256257
$constraint = IsBsonType::anyOf(...(array) $operator['$$type']);
257258

258259
if (! $constraint->evaluate($actual, '', true)) {
259-
self::failAt(sprintf('%s is not an expected BSON type: %s', $this->exporter()->shortenedExport($actual), implode(', ', (array) $operator['$$type'])), $keyPath);
260+
self::failAt(sprintf('%s is not an expected BSON type: %s', (new Exporter())->shortenedExport($actual), implode(', ', (array) $operator['$$type'])), $keyPath);
260261
}
261262

262263
return;
@@ -284,7 +285,7 @@ private function assertMatchesOperator(BSONDocument $operator, $actual, string $
284285
assertIsString($actual);
285286

286287
if ($actual !== hex2bin($operator['$$matchesHexBytes'])) {
287-
self::failAt(sprintf('%s does not match expected hex bytes: %s', $this->exporter()->shortenedExport($actual), $operator['$$matchesHexBytes']), $keyPath);
288+
self::failAt(sprintf('%s does not match expected hex bytes: %s', (new Exporter())->shortenedExport($actual), $operator['$$matchesHexBytes']), $keyPath);
288289
}
289290

290291
return;
@@ -349,7 +350,7 @@ protected function matches($other): bool
349350

350351
public function toString(): string
351352
{
352-
return 'matches ' . $this->exporter()->export($this->value);
353+
return 'matches ' . (new Exporter())->export($this->value);
353354
}
354355

355356
/** @psalm-return never-return */

0 commit comments

Comments
 (0)