Skip to content

Commit 6df4fd7

Browse files
committed
Revert assertDocumentsMatch
1 parent 567f750 commit 6df4fd7

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

tests/FunctionalTestCase.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use MongoDB\Operation\CreateCollection;
1717
use MongoDB\Operation\DatabaseCommand;
1818
use MongoDB\Operation\ListCollections;
19-
use MongoDB\Tests\SpecTests\DocumentsMatchConstraint;
2019
use stdClass;
2120
use UnexpectedValueException;
2221

@@ -205,21 +204,6 @@ protected function assertSameObjectId($expectedObjectId, $actualObjectId): void
205204
$this->assertEquals((string) $expectedObjectId, (string) $actualObjectId);
206205
}
207206

208-
/**
209-
* Asserts that two given documents match.
210-
*
211-
* Extra keys in the actual value's document(s) will be ignored.
212-
*
213-
* @param array|object $expectedDocument
214-
* @param array|object $actualDocument
215-
*/
216-
public static function assertDocumentsMatch($expectedDocument, $actualDocument, string $message = ''): void
217-
{
218-
$constraint = new DocumentsMatchConstraint($expectedDocument, true, true);
219-
220-
static::assertThat($actualDocument, $constraint, $message);
221-
}
222-
223207
/**
224208
* Configure a fail point for the test.
225209
*

tests/SpecTests/FunctionalTestCase.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,21 @@ public static function assertCommandReplyMatches(stdClass $expected, stdClass $a
8181
throw new LogicException(sprintf('%s does not assert CommandSucceededEvents', static::class));
8282
}
8383

84+
/**
85+
* Asserts that two given documents match.
86+
*
87+
* Extra keys in the actual value's document(s) will be ignored.
88+
*
89+
* @param array|object $expectedDocument
90+
* @param array|object $actualDocument
91+
*/
92+
public static function assertDocumentsMatch($expectedDocument, $actualDocument, string $message = ''): void
93+
{
94+
$constraint = new DocumentsMatchConstraint($expectedDocument, true, true);
95+
96+
static::assertThat($actualDocument, $constraint, $message);
97+
}
98+
8499
/**
85100
* Assert omitted top-level fields in command documents.
86101
*

tests/SpecTests/SearchIndexSpecTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testCreateAndListSearchIndexes(): void
5858

5959
$this->assertCount(1, $indexes);
6060
$this->assertSame($name, $indexes[0]->name);
61-
$this->assertDocumentsMatch($mapping, $indexes[0]->latestDefinition);
61+
$this->assertSameDocument($mapping, $indexes[0]->latestDefinition);
6262
}
6363

6464
/**
@@ -84,7 +84,7 @@ public function testCreateMultipleIndexesInBatch(): void
8484
foreach ($names as $key => $name) {
8585
$index = $indexes[$key];
8686
$this->assertSame($name, $index->name);
87-
$this->assertDocumentsMatch($mapping, $index->latestDefinition);
87+
$this->assertSameDocument($mapping, $index->latestDefinition);
8888
}
8989
}
9090

@@ -141,7 +141,7 @@ public function testUpdateSearchIndex(): void
141141

142142
$this->assertCount(1, $indexes);
143143
$this->assertSame($name, $indexes[0]->name);
144-
$this->assertDocumentsMatch($mapping, $indexes[0]->latestDefinition);
144+
$this->assertSameDocument($mapping, $indexes[0]->latestDefinition);
145145
}
146146

147147
/**

0 commit comments

Comments
 (0)