Catalinul's avatar

Laravel 9 Test with transaction freezes

So I have a problem with a functional test, I am using RefreshDatabase trait. The database is PostgreSQL, everything is ran with docker. The problem is that I have two methods that use $this->beginDatabaseTransaction() inside each method at the top and when I try to see if the test passes, everything freezes. No output back, no error nothing, it just stalls. I remove the $this->beginDatabaseTransaction() and I get green.

Thank you, I am trying to figure out if I can see where is the problem...

0 likes
4 replies
Catalinul's avatar

@Sinnbeck Good idea, but that's how it works by default, on a clean Laravel 9 project I have no problem with $this->beginDatabaseTransaction().

Sinnbeck's avatar

@Catalinul so if you use RefreshDatabase along with a transaction in a controller on a new project, it works. But on your current project it freezes?

Catalinul's avatar

@Sinnbeck I am using this for testing, it's inside two methods from a test class where I use RefreshDatabase. Yes, it's very strange.

Please or to participate in this conversation.