Skip to content
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

Db transactions #127

Open
gerardZf2Comments opened this issue Jan 4, 2016 · 1 comment
Open

Db transactions #127

gerardZf2Comments opened this issue Jan 4, 2016 · 1 comment

Comments

@gerardZf2Comments
Copy link

Sorry to open an issue without running any code but i think i have enough info to ask what others may be wondering.

Mysql seems to commit open transactions when a new one is open. http://stackoverflow.com/questions/1490846/mysql-transactions-within-transactions

So how does the transaction trait in this package work if the code called in the test starts a new transaction and commits it. In this case could a rollback work?

If not does that mean this trait can only be used to test code that doesn't use transactions?

@bobbybouwmann
Copy link

I don't think you should be using multiple transactions at all when running integration tests! You are testing a single feature of an application and this can mean multiple database calls. However you only want to start the transaction before the test and rollback when the test is done (if it succeeds or not).

It's a trait which you use in your code. If you already use transactions in your code, you simply don't use the trait. I don't think there is a way to get around this, since it's MySQL that's doing this. Not the package or in this case the database provider in Laravel

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

No branches or pull requests

2 participants