Skip to content

PDOException: There is no active transaction #197

Open
@SophieBoewa

Description

@SophieBoewa

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions