Skip to content

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

Merged
merged 9 commits into from
Feb 3, 2020
Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Jan 28, 2020

@alcaeus alcaeus requested a review from jmikola January 28, 2020 15:18
@alcaeus alcaeus self-assigned this Jan 28, 2020
@alcaeus alcaeus force-pushed the phplib-510 branch 2 times, most recently from b66cf5c to 7842500 Compare January 31, 2020 13:59
@alcaeus alcaeus requested a review from jmikola January 31, 2020 16:03
Copy link
Member

@jmikola jmikola left a 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);
Copy link
Member

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.

alcaeus added a commit that referenced this pull request Feb 3, 2020
@alcaeus alcaeus merged commit 37c8e99 into master Feb 3, 2020
@alcaeus alcaeus deleted the phplib-510 branch February 3, 2020 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants