# Resetting the DB when running specific test suites locally

**URL:** <https://forum.mautic.org/t/resetting-the-db-when-running-specific-test-suites-locally/36450>\
**Category:** Development\
**Created:** [September 2, 2025, 5:55pm UTC](https://forum.mautic.org/t/resetting-the-db-when-running-specific-test-suites-locally/36450 "2025-09-02T17:55:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolcode](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lolcode/32/12928_2.png) [@lolcode](https://forum.mautic.org/u/lolcode)\
**Post date:** [September 2, 2025, 5:55pm UTC](https://forum.mautic.org/t/resetting-the-db-when-running-specific-test-suites-locally/36450/1 "2025-09-02T17:55:40Z")

</div>

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.`

```auto
Runtime: PHP 8.4.10Configuration: /var/www/html/app/phpunit.xml.dist

```

```auto
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%)

```

```auto
Time: 00:55.666, Memory: 254.00 MB

```

```auto
There was 1 failure:

```

1. 

```auto
Mautic\LeadBundle\Tests\Command\DeduplicateCommandFunctionalTest::testDeduplicateCommandWithUniqueEmailSome contacts were forgotten to remove from other testsFailed asserting that 1 is identical to 0.

```

```auto
/var/www/html/app/bundles/LeadBundle/Tests/Command/DeduplicateCommandFunctionalTest.php:33

```

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [September 8, 2025, 7:35am UTC](https://forum.mautic.org/t/resetting-the-db-when-running-specific-test-suites-locally/36450/2 "2025-09-08T07:35:46Z")

</div>

Hi, PHPUNIT tests will clean up after themselves after each test. If they don’t then it’s a sideeffect.

Also make sure that the tests run in its own database. Not the one that you use for manual tests:

> **[Environments — Mautic Developer Documentation 3.0.0 documentation](https://devdocs.mautic.org/en/5.x/development-environment/environments.html#development-environment)**
