Transaction problem in phpunit, PDOException: There is no active transaction
1. Operating environment
laradock container
1). What version of Laravel are you currently using?
laravel 5.8, laravels package applied, php7.4
Problem Description
When the test class is written, the environment is laravel 5.5. everything is normal.
Now after upgrading to laravel5.8 and introducing the laravels extension, this problem occurs, phpunit version 8.5
When executed, the entire class file is executed together
php vendor/phpunit/phpunit/phpunit tests/Feature/Mobile/PointTest.php
The same data is obtained in the two methods. In the second method, the error is reported and there is no transaction.
PDOException: There is no active transaction
It has been solved, and the pot of persistent database connection is turned on. Is there any risk of redis persistent connection?
Another solution, introducing this trait, can also solve use Illuminate\Foundation\Testing\DatabaseTransactions;
0 Comments