I am running ddev and I have a particular branch checked out to review a pull request. I am making a couple of small changes and wanted to run the two test suites that are involved in the pull request. How do I make sure the DB is cleaned up between test runs if I am not running the whole suite?
Here’s my bash history
2049 ddev exec bin/phpunit -d memory_limit=2G --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist app/bundles/LeadBundle/Tests/
2050 ddev exec bin/phpunit -d memory_limit=2G --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist app/bundles/CoreBundle/Tests/Unit/Helper/
2051 ddev exec bin/phpunit -d memory_limit=2G --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist app/bundles/LeadBundle/Tests/Entity/
2052 ddev exec bin/phpunit -d memory_limit=2G --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist app/bundles/LeadBundle/Tests/
The second time I run app/bundles/LeadBundle/Tests/ I get an error:
me@machine:~/workspace/$ ddev exec bin/phpunit -d memory_limit=2G --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist app/bundles/LeadBundle/Tests/PHPUnit 10.5.45 by Sebastian Bergmann and contributors.
Runtime: PHP 8.4.10Configuration: /var/www/html/app/phpunit.xml.dist
using db prefix “test_”…F… 61 / 1359 ( 4%)… 122 / 1359 ( 8%)…W… 183 / 1359 ( 13%)… 244 / 1359 ( 17%)… 305 / 1359 ( 22%)… 366 / 1359 ( 26%)… 427 / 1359 ( 31%)… 488 / 1359 ( 35%)… 549 / 1359 ( 40%)… 610 / 1359 ( 44%)… 671 / 1359 ( 49%)… 732 / 1359 ( 53%)… 793 / 1359 ( 58%)… 854 / 1359 ( 62%)… 915 / 1359 ( 67%)… 976 / 1359 ( 71%)… 1037 / 1359 ( 76%)… 1098 / 1359 ( 80%)… 1159 / 1359 ( 85%)… 1220 / 1359 ( 89%)… 1281 / 1359 ( 94%)… 1342 / 1359 ( 98%)… 1359 / 1359 (100%)
Time: 00:55.666, Memory: 254.00 MB
There was 1 failure:
-
Mautic\LeadBundle\Tests\Command\DeduplicateCommandFunctionalTest::testDeduplicateCommandWithUniqueEmailSome contacts were forgotten to remove from other testsFailed asserting that 1 is identical to 0.
/var/www/html/app/bundles/LeadBundle/Tests/Command/DeduplicateCommandFunctionalTest.php:33