# Unit testing for a pipeline

**URL:** <https://forum.mautic.org/t/unit-testing-for-a-pipeline/24335>\
**Category:** Development\
**Created:** [June 2, 2022, 2:15pm UTC](https://forum.mautic.org/t/unit-testing-for-a-pipeline/24335 "2022-06-02T14:15:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![astrylis](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/astrylis/32/6421_2.png) [@astrylis](https://forum.mautic.org/u/astrylis)\
**Post date:** [June 2, 2022, 2:15pm UTC](https://forum.mautic.org/t/unit-testing-for-a-pipeline/24335/1 "2022-06-02T14:15:30Z")

</div>

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

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

```

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

Thank you

Daniel

---

<div class="post-metadata">

**Author:** ![galvani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/galvani/32/8068_2.png) [@galvani](https://forum.mautic.org/u/galvani)\
**Post date:** [August 18, 2022, 2:24pm UTC](https://forum.mautic.org/t/unit-testing-for-a-pipeline/24335/2 "2022-08-18T14:24:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![astrylis](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/astrylis/32/6421_2.png) [@astrylis](https://forum.mautic.org/u/astrylis)\
**Post date:** [August 18, 2022, 2:46pm UTC](https://forum.mautic.org/t/unit-testing-for-a-pipeline/24335/3 "2022-08-18T14:46:21Z")

</div>

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

---

<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:** [August 20, 2022, 2:46am UTC](https://forum.mautic.org/t/unit-testing-for-a-pipeline/24335/4 "2022-08-20T02:46:25Z")

</div>

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