Skip to content

PHPLIB-816: Cleanup collections created when tests are successful #1075

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 11 commits into from
Jun 1, 2023

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented May 19, 2023

Fix PHPLIB-816

  • Update FunctionalTestCase::createCollection and FunctionalTestCase::dropCollection to accept a different database and collection name.
  • Remove automatically the collections created or dropped using this helper methods.
  • Use this methods when possible.

@GromNaN GromNaN requested review from jmikola and alcaeus May 19, 2023 14:16
@@ -64,6 +68,10 @@ public function setUp(): void

public function tearDown(): void
{
if (! $this->hasFailed()) {
$this->cleanupCollections();
Copy link
Member Author

Choose a reason for hiding this comment

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

Overriding the tearDown method in child classes is no longer necessary: the collection will be automagically dropped when the test calls createCollection or dropCollection.

@GromNaN GromNaN requested a review from jmikola May 22, 2023 09:37
@GromNaN GromNaN force-pushed the PHPLIB-816 branch 2 times, most recently from c5db761 to bef00b3 Compare May 22, 2023 10:59
@GromNaN GromNaN force-pushed the PHPLIB-816 branch 2 times, most recently from 8583847 to 0873458 Compare May 23, 2023 08:56
@GromNaN GromNaN requested a review from jmikola May 23, 2023 09:16
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.

Two minor suggestions, which you can address on your own.

@GromNaN GromNaN changed the title PHPLIB-816: Cleanup databases and collections in DocumentationExamplesTest PHPLIB-816: Cleanup collections created when test are successful May 25, 2023
@GromNaN GromNaN changed the title PHPLIB-816: Cleanup collections created when test are successful PHPLIB-816: Cleanup collections created when tests are successful May 25, 2023
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 very minor question but LGTM.

Great work on this 🎉

@GromNaN GromNaN merged commit b3b6b0b into mongodb:master Jun 1, 2023
@GromNaN GromNaN deleted the PHPLIB-816 branch June 1, 2023 15:27
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