Skip to content

Commit 829e2bb

Browse files
committed
Upgrade DocumentsMatchConstraint
1 parent 2734c0b commit 829e2bb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tests/SpecTests/DocumentsMatchConstraint.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use RuntimeException;
1313
use SebastianBergmann\Comparator\ComparisonFailure;
1414
use SebastianBergmann\Comparator\Factory;
15+
use SebastianBergmann\Exporter\Exporter;
1516
use stdClass;
1617

1718
use function array_values;
@@ -80,12 +81,12 @@ public function evaluate($other, string $description = '', bool $returnResult =
8081
$this->assertEquals($this->value, $other, $this->ignoreExtraKeysInRoot);
8182
$success = true;
8283
} catch (RuntimeException $e) {
84+
$exporter = new Exporter();
8385
$this->lastFailure = new ComparisonFailure(
8486
$this->value,
8587
$other,
86-
$this->exporter()->export($this->value),
87-
$this->exporter()->export($other),
88-
false,
88+
$exporter->export($this->value),
89+
$exporter->export($other),
8990
$e->getMessage(),
9091
);
9192
}
@@ -123,7 +124,7 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $
123124
if ($expected::class !== $actual::class) {
124125
throw new RuntimeException(sprintf(
125126
'%s is not instance of expected class "%s"',
126-
$this->exporter()->shortenedExport($actual),
127+
(new Exporter())->shortenedExport($actual),
127128
$expected::class,
128129
));
129130
}
@@ -162,11 +163,10 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $
162163
$actualValue,
163164
'',
164165
'',
165-
false,
166166
sprintf(
167167
'Field path "%s": %s is not instance of expected type "%s".',
168168
$keyPrefix . $key,
169-
$this->exporter()->shortenedExport($actualValue),
169+
(new Exporter())->shortenedExport($actualValue),
170170
$expectedType,
171171
),
172172
);
@@ -180,7 +180,6 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $
180180
$actualValue,
181181
'',
182182
'',
183-
false,
184183
sprintf('Field path "%s": %s', $keyPrefix . $key, $failure->getMessage()),
185184
);
186185
}
@@ -233,7 +232,7 @@ protected function matches($other): bool
233232

234233
public function toString(): string
235234
{
236-
return 'matches ' . $this->exporter()->export($this->value);
235+
return 'matches ' . (new Exporter())->export($this->value);
237236
}
238237

239238
private static function isNumeric($value): bool

0 commit comments

Comments
 (0)