# CakePHP 4 PHPUnit testing - fixture listener

**URL:** <https://discourse.cakephp.org/t/cakephp-4-phpunit-testing-fixture-listener/8503>\
**Category:** Testing\
**Tags:** help\
**Created:** [October 14, 2020, 4:55pm UTC](https://discourse.cakephp.org/t/cakephp-4-phpunit-testing-fixture-listener/8503 "2020-10-14T16:55:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thornstrom](https://avatars.discourse-cdn.com/v4/letter/t/5f8ce5/32.png) [@thornstrom](https://discourse.cakephp.org/u/thornstrom)\
**Post date:** [October 14, 2020, 4:55pm UTC](https://discourse.cakephp.org/t/cakephp-4-phpunit-testing-fixture-listener/8503/1 "2020-10-14T16:55:56Z")

</div>

Hi, I’m having trouble setting up the fixture listener for my project.

I’ve added the xml in phpunit.xml.dist:

```
  <!-- Setup a listener for fixtures -->
    <listeners>
        <listener class="Cake\TestSuite\Fixture\FixtureInjector">
            <arguments>
                <object class="Cake\TestSuite\Fixture\FixtureManager"/>
            </arguments>
        </listener>
    </listeners>

```

My composer.json contains the following rows:

```
"autoload": {
    "psr-4": {
        "App\\": "src/"
    }
},
"autoload-dev": {
    "psr-4": {
        "App\\Test\\": "tests/",
        "Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
    }
},

```

But when I run ‘phpunit.bat tests’ from the cli, it gives me the following error:

Class ‘Cake\TestSuite\Fixture\FixtureManager’ not found

Anyone knows why?

---

<div class="post-metadata">

**Author:** ![pabloelcolombiano](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/pabloelcolombiano/32/2095_2.png) [@pabloelcolombiano](https://discourse.cakephp.org/u/pabloelcolombiano)\
**Post date:** [October 16, 2020, 2:11pm UTC](https://discourse.cakephp.org/t/cakephp-4-phpunit-testing-fixture-listener/8503/2 "2020-10-16T14:11:52Z")

</div>

What does your complete phpunit.xml.dist file look like?

---

<div class="post-metadata">

**Author:** ![thornstrom](https://avatars.discourse-cdn.com/v4/letter/t/5f8ce5/32.png) [@thornstrom](https://discourse.cakephp.org/u/thornstrom)\
**Post date:** [October 17, 2020, 1:06am UTC](https://discourse.cakephp.org/t/cakephp-4-phpunit-testing-fixture-listener/8503/3 "2020-10-17T01:06:48Z")

</div>

Thanks for the reply. I solved it by executing the tests with the framework’s phpunit.bat, instead of the one from my local web server (xampp):

`vendor/bin/phpunit.bat tests`
