liip / liip/LiipTestFixturesBundle

PDOException: There is no active transaction

Open
#197 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
178
Forks
48
PR merge metrics
No merged PRs in 30d

Description

Hey,

When i try to load Fixtures, pdo throws the exception from above. I found a workaround using TransactionHelper from Doctrine, but therefore i have to edit the Doctrine EntityManager, and i don't think that this should be the way to go.

    public function setUp(): void
    {
        parent::setUp();
        $this->client = self::createClient([],[]);
        $this->databaseTool = $this->getContainer()->get(DatabaseToolCollection::class)->get();
        $this->executor = $this->databaseTool->loadFixtures($this->getFixtureClasses());
    }

using this code, i get the following stacktrace:

  1. App\Tests\Controller\AppBundle\AnonymousRedirectCrawlTest::testAnonymousRedirected with data set #0 ('/', '/login')
    PDOException: There is no active transaction
    /var/www/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1854
    /var/www/app/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:253
    /var/www/app/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php:76
    /var/www/app/vendor/liip/test-fixtures-bundle/src/Services/DatabaseTools/ORMDatabaseTool.php:130
    /var/www/app/tests/Setup/AbstractCrawlTest.php:70

I'm using PHP 8.1.7, PHPUnit 8.5.27,
liip/test-fixtures-bundle 2.4.0

Maybe you got a solution, on how to fix this Problem.

Ps. It's my first time, writing an Issue, so if sth. is missing, please tell me.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the fixture-loading failure from tests/Setup/AbstractCrawlTest.php:70 and trace the transaction handling through ORMDatabaseTool.php:130, ORMExecutor.php:76, and the EntityManager stack frame. Check the reported PHP, PHPUnit, and liip/test-fixtures-bundle versions. Done means fixture loading no longer raises “There is no active transaction” and the failure has a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
database, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.