-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-510: Implement spec test runner for FLE #715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b66cf5c
to
7842500
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion about assertOutcomeCollectionData
but I'll defer to you. LGTM otherwise.
@@ -274,6 +287,10 @@ public function assert(TestCase $test, $actual) | |||
$test->assertSameDocuments($expected, $actual); | |||
break; | |||
|
|||
case self::ASSERT_DOCUMENTS_MATCH: | |||
$test->assertDocumentsMatch($expected, $actual); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially thought this might be redundant in light of ASSERT_MATCHES_DOCUMENT
, but I remembered that they're actually different. MongoDB\Tests\SpecTests\FunctionalTestCase::assertDocumentsMatch()
uses DocumentsMatchConstraint, configured to ignore extra keys in both root and embedded documents. ASSERT_MATCHES_DOCUMENT
does a quick type check on both arguments (expected and actual) and then delegates to MongoDB\Tests\TestCase::assertMatchesDocument()
, which re-orders fields and manually unsets extra keys in the actual value before converting both documents to JSON and doing a string comparison.
We already have PHPLIB-436 in our backlog to refactor assertMatchesDocument
to use DocumentsMatchConstraint so I don't think we need a new comment in this code to reference that; however, I'll add a note in the JIRA issue to consolidate ASSERT_MATCHES_DOCUMENT
and ASSERT_DOCUMENTS_MATCH
down the line.
https://jira.mongodb.org/browse/PHPLIB-510