Unit testing for a pipeline

Hey Mautic

I am trying to get unit testing to work using a different database, but for the life of me I cannot get it to connect to the test db. Now we are currently using v3 of mautic and I am not the person who originally set this up but they do not use the env file. Instead they are using php config files.

I have done a good rumage and I see there is a config_test.php and modifying the part that has doctrine to connect to the test db is not helping. I have also included the following into the phpunit.xml.dist file in the app folder but this is also resulting in a SQLSTATE[HY000] [2002] Connection Refused

<server name="db_name" value="mautic2test" />

Has anyone been able to get unit testing to work with config files?

Thank you


I believe you need to configure either .env or .env.dist; if no .env in place. It did the job for me but still I fought with db prefixes added by the mautic extension.

You are correct @galvani I did exactly that and unit testing is working locally :smiley:

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