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

Filament tests failing with testbench 9.x #393

Closed
mokhosh opened this issue Feb 27, 2024 · 2 comments
Closed

Filament tests failing with testbench 9.x #393

mokhosh opened this issue Feb 27, 2024 · 2 comments

Comments

@mokhosh
Copy link

mokhosh commented Feb 27, 2024

  • Testbench Version: 9.x-dev c1a5b1f
  • Laravel Version: dev-master 39561b1
  • PHP Version: 8.3.3
  • Database Driver & Version: sqlite :memory:

Description:

We've been working on dependencies supporting Laravel 11 to be able to support it in Filament. filamentphp/filament#10972

Now the dependencies are ok, but most tests fail with this error:

  FAILED  Tests\src\Actions\ActionTest > it can call an action with data                                  PDOException
  There is already an active transaction

  at vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php:150
    146if ($this->transactions == 0) {
    147$this->reconnectIfMissingConnection();
    148149try {
  ➜ 150$this->getPdo()->beginTransaction();
    151▕             } catch (Throwable $e) {
    152$this->handleBeginTransactionException($e);
    153▕             }
    154▕         } elseif ($this->transactions >= 1 && $this->queryGrammar->supportsSavepoints()) {

I checked out the PRs and commits of laravel/framework, but none of them seemed to have caused the issue. I'm guessing it's a testbench issue, specially after going through this PR laravel/framework#49385

Can you please shed some light?

Steps To Reproduce:

  • git clone git@github.com:filamentphp/filament.git && cd filament
  • git checkout laravel-11
  • composer install
  • composer test
@crynobone
Copy link
Member

laravel/framework#49385 is not merged yet and has nothing to do with this issue.

@crynobone
Copy link
Member

See laravel/framework#47912

In Laravel 11, RefreshDatabase and LazilyRefreshDatabase combined with in-memory database will keep PDO instances between tests and is the root cause of this issue. You would need to reset RefreshDatabaseState between tests.

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