Skip to content

Wrong database isolation between tests or missing cleanups#1721

Merged
maghamed merged 1 commit intoMSI-1486from
MSI-1486-tests-isolation
Oct 3, 2018
Merged

Wrong database isolation between tests or missing cleanups#1721
maghamed merged 1 commit intoMSI-1486from
MSI-1486-tests-isolation

Conversation

@phoenix128
Copy link
Copy Markdown
Contributor

Some of the tests were turning off database isolation for no reason and others were not cleaning modified database information

Some of the tests were turning off database isolation for no reason and others were not cleaning modified database information
@maghamed maghamed added this to the MSI Part II milestone Oct 3, 2018
$isSalableResult = $this->isProductSalableForRequestedQty->execute($sku, $stockId, $qty)->isSalable();

// Clean up
$this->saveStockConfiguration->forStockItem($sku, $stockId, $oldStockItemConfiguration);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

as for me in general it's better to move cleaning logic in the tearDown


// Clean up
$this->saveStockConfiguration->forStock($stockId, $oldStockConfiguration);
$this->saveStockConfiguration->forStockItem($sku, $stockId, $oldStockItemConfiguration);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree with you, but in this case we had a dataProvider and this was the best way to clean each single modification. In teardown it becomes quite messy and I should retake all the information from the dataproviders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants