# Errors Running Tests Locally

**URL:** <https://forum.mautic.org/t/errors-running-tests-locally/35162>\
**Category:** Development\
**Created:** [March 2, 2025, 10:54pm UTC](https://forum.mautic.org/t/errors-running-tests-locally/35162 "2025-03-02T22:54:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![saramatos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/saramatos/32/13467_2.png) [@saramatos](https://forum.mautic.org/u/saramatos)\
**Post date:** [March 2, 2025, 10:54pm UTC](https://forum.mautic.org/t/errors-running-tests-locally/35162/1 "2025-03-02T22:54:17Z")

</div>

Hello!  
I’m trying to run the tests locally on branch 5.2, but I’m encountering a lot of errors even without changing the code. For context, I’m running on a MacBook M3 with DDEV. I’ve searched through and read the documentation but I could really use some help.

In the unit tests:

- Datetime failure: After some research, I found that a PR already fixed it, but for some reason it’s not working for me.
- Multiple errors related to: `Error: Call to undefined method Symfony\Bundle\FrameworkBundle\Test\TestContainer::setPublicContainer().`

In the e2e-tests, lots of errors similar to this:

```auto
5) ContactManagementCest: Batch change owner 
Test tests/acceptance/ContactManagementCest.php:batchChangeOwner
 Step See "Sales User","//*[@id="app-content"]/div/div[2]/div[2]/div[1]/div[4]/p[1]"
 Fail Failed asserting that any element by '//*[@id="app-content"]/div/div[2]/div[2]/div[1]/div[4]/p[1]' on page /s/contacts/view/16
Elements: 
+ <p> HenryLCatalano@einrot.com
contains text 'Sales User'

```

Thank you

---

<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:** [March 3, 2025, 8:06am UTC](https://forum.mautic.org/t/errors-running-tests-locally/35162/2 "2025-03-03T08:06:55Z")

</div>

Hi, how did you install or upgrade Mautic? Did you change branch from an older Mautic version? Try to run `composer install` to also update the dependencies. But it’s hard to advise without steps to replicate.

---

<div class="post-metadata">

**Author:** ![saramatos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/saramatos/32/13467_2.png) [@saramatos](https://forum.mautic.org/u/saramatos)\
**Post date:** [March 3, 2025, 11:00am UTC](https://forum.mautic.org/t/errors-running-tests-locally/35162/3 "2025-03-03T11:00:22Z")

</div>

Hi! I forked the repository, cloned it, and checked out branch 5.2. I followed the instructions from Local Mautic development with DDEV:

```auto
ddev config  
ddev start

```

I replaced /.ddev/.env.test.local with the one from the blog post.

`ddev exec composer test`

After the tests failed, i did

```auto
ddev ssh 
composer install

```

and i got these warnings

```auto
> Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
> Package theofidry/psysh-bundle is abandoned, you should avoid using it. No replacement was suggested.

```

Don’t know if it useful to understand where the problem but when i do ddev exec composer test it says

> using db prefix “test\_”

I have also tried `ddev restart`

---

<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:** [March 3, 2025, 11:34am UTC](https://forum.mautic.org/t/errors-running-tests-locally/35162/4 "2025-03-03T11:34:16Z")

</div>

> using db prefix “test\_”

That’s just an info message before the tests start. Are you still getting the same error as before?

I rarely run the whole test suite as it takes ages. Are you interested in running a specific test? What is the goal?

---

<div class="post-metadata">

**Author:** ![saramatos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/saramatos/32/13467_2.png) [@saramatos](https://forum.mautic.org/u/saramatos)\
**Post date:** [March 3, 2025, 12:10pm UTC](https://forum.mautic.org/t/errors-running-tests-locally/35162/5 "2025-03-03T12:10:46Z")

</div>

I think I found a fix for issue #12795. I tried running the tests to ensure everything is working. Now, I tried running only the PointBundle tests inside `ddev ssh` with

```auto
/var/www/html$ bin/phpunit --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist --filter PointBundle

```

and I’m getting this error now:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/a95189f3b31a4baf507d050442e54029c393ff2c.png)

I sincerely apologize for the inconvenience, and I truly appreciate your help.

---

<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:** [March 3, 2025, 12:25pm UTC](https://forum.mautic.org/t/errors-running-tests-locally/35162/6 "2025-03-03T12:25:28Z")

</div>

The tests cannot connect to the testing database. Double-check that the DB credentials in the .env.test.local are correct. This is ho my config looks like:

```auto
DB_HOST=db
DB_USER=root
DB_PASSWD=root
DB_NAME=test

```

The whole test suite also runs in GitHub Actions so you’ll get notified if something fails once you submit a pull request.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [March 5, 2025, 12:25am UTC](https://forum.mautic.org/t/errors-running-tests-locally/35162/7 "2025-03-05T00:25:31Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
