• notice
  • Congratulations on the launch of the Sought Tech site

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

Transaction problems in phpunit, I don't understand at all

Transaction problems in phpunit, I don't understand at all


It has been solved, and the pot of persistent database connection is turned on. Is there any risk of redis persistent connection?

file

Another solution, introducing this trait, can also solve use Illuminate\Foundation\Testing\DatabaseTransactions;

file



Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+