Skip to content

PHPLIB-481: Add the ability to specify a pipeline to an update within bulk write #684

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 3 commits into from
Oct 8, 2019

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Oct 1, 2019

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.

I've noted that this depends on mongodb/specifications#651 being merged.

@@ -263,7 +263,7 @@ public function provideOpsWithMissingArguments()
public function testUpdateOneRequiresUpdateOperators()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('First key in $operations[0]["updateOne"][1] is not an update operator');
$this->expectExceptionMessage('First key in $operations[0]["updateOne"][1] is neither an update operator nor a pipeline');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test title should probably be changed to "RequiresUpdateOperatorsOrPipeline".

That said, are these test redundant in light of the other two tests we have in BulkWriteTest.php (later in this PR)? They look very similar, except the ones in the other file use constants for the operation name.

If so, I think the correct place for these is the non-functional BulkWriteTest.php class, in which case you can delete the two methods in BulkWriteFunctionalTest.php. May want to check for other duplicated tests while you're in here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I've removed these and a few other tests that were duplicated and didn't run the bulk writes.

@@ -272,7 +272,7 @@ public function testUpdateOneRequiresUpdateOperators()
public function testUpdateManyRequiresUpdateOperators()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('First key in $operations[0]["updateMany"][1] is not an update operator');
$this->expectExceptionMessage('First key in $operations[0]["updateMany"][1] is neither an update operator nor a pipeline');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise with this test title, although this may be irrelevant given the rest of my previous comment about test duplication.

@alcaeus alcaeus force-pushed the fix-bulkwrite-pipeline branch from 97249da to fe3278a Compare October 2, 2019 06:22
@alcaeus
Copy link
Member Author

alcaeus commented Oct 2, 2019

Note: mongodb/specifications#651 has been merged.

@alcaeus alcaeus force-pushed the fix-bulkwrite-pipeline branch from fe3278a to 383f90a Compare October 2, 2019 06:38
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.

I assume the JSON tests are already in sync with whatever was merged in mongodb/specifications#651. I'm not sure if they actually had to change in this PR or not.

Changes LGTM!

@alcaeus
Copy link
Member Author

alcaeus commented Oct 7, 2019

I assume the JSON tests are already in sync with whatever was merged in mongodb/specifications#651. I'm not sure if they actually had to change in this PR or not.

I used this PR to validate the new tests and ensure that everything was working as expected 👍

@alcaeus alcaeus force-pushed the fix-bulkwrite-pipeline branch from 383f90a to d44bd16 Compare October 8, 2019 06:11
@alcaeus alcaeus merged commit b6b972c into mongodb:v1.5 Oct 8, 2019
@alcaeus alcaeus deleted the fix-bulkwrite-pipeline branch October 8, 2019 10:26
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