Errors Running Tests Locally

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:

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

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.

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

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

ddev ssh 
composer install

and i got these warnings

> 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

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?

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

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

and I’m getting this error now:

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

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:

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.

1 Like

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