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

roll back transactions for tests marked as incomplete in setUp() #311

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

xabbuh
Copy link
Contributor

@xabbuh xabbuh commented Feb 1, 2025

The test suite would fail like this without the changes in the PHPUnitExtension:

PHPUnit 11.5.6 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.27
Configuration: /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/tests/phpunit.xml

........................SSI....

Time: 00:00.060, Memory: 26.00 MB

There was 1 PHPUnit test runner warning:

1) Exception in third-party event subscriber: There is already an active transaction
#0 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/doctrine/dbal/src/Driver/PDO/Connection.php(107): Doctrine\DBAL\Driver\PDO\Exception::new()
#1 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticDriver.php(60): Doctrine\DBAL\Driver\PDO\Connection->beginTransaction()
#2 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitExtension.php(57): DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver::beginTransaction()
#3 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/Event/Dispatcher/DirectDispatcher.php(106): PHPUnit\Event\Test\PreparationStartedSubscriber@anonymous->notify()
#4 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/Event/Dispatcher/DeferringDispatcher.php(47): PHPUnit\Event\DirectDispatcher->dispatch()
#5 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/Event/Emitter/DispatchingEmitter.php(318): PHPUnit\Event\DeferringDispatcher->dispatch()
#6 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/Framework/TestCase.php(478): PHPUnit\Event\DispatchingEmitter->testPreparationStarted()
#7 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
#8 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/Framework/TestCase.php(361): PHPUnit\Framework\TestRunner->run()
#9 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
#10 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
#11 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
#12 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run()
#13 /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run()
#[14](https://github.com/xabbuh/doctrine-test-bundle/actions/runs/13088439798/job/36522368758#step:9:15) /home/runner/work/doctrine-test-bundle/doctrine-test-bundle/vendor/bin/phpunit(122): include('...')
#[15](https://github.com/xabbuh/doctrine-test-bundle/actions/runs/13088439798/job/36522368758#step:9:16) {main}

WARNINGS!
Tests: 31, Assertions: 108, Warnings: 1, PHPUnit Deprecations: 8, Skipped: 2, Incomplete: 2.

@xabbuh xabbuh force-pushed the incomplete-in-set-up branch from d208ae4 to cb734b6 Compare February 1, 2025 12:18
@xabbuh xabbuh force-pushed the incomplete-in-set-up branch from cb734b6 to 1ffef30 Compare February 1, 2025 12:31
Copy link
Owner

@dmaicher dmaicher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Thanks @xabbuh

@dmaicher dmaicher merged commit 1eab74f into dmaicher:master Feb 1, 2025
11 checks passed
@xabbuh xabbuh deleted the incomplete-in-set-up branch February 1, 2025 12:41
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

Successfully merging this pull request may close these issues.

2 participants