Jump to content

Dump() are not loaded when running tests with phpunit.


Recommended Posts

Hello! I develop a Prestashop module and I would like to create some tests with phpunit. I don't know why but some methods like dump() are not loaded properly.. 

tests/KernelTest.php

<?php

namespace PrestaShop\Module\MyModule\Tests;

use Nette\DI\Container;
use PHPUnit\Framework\TestCase;

class KernelTest extends TestCase
{
    public function testKernel()
    {
        dump(Container::class);
        $this->assertTrue(true);
    }
}

 

The following code returns :
Error: Call to undefined function PrestaShop\Module\MyModule\Tests\dump()

I use the PSR-4 composer autoloader, everything else is worklng perfecly (yet). 

I tried to download the symfony/var-dumper() package but it doesn't solve anything..

This is my PSR-4 configuration:

"autoload": {
  "psr-4": {
    "PrestaShop\\Module\\MyModule\\": "src/",
    "PrestaShop\\Module\\MyModule\\Tests\\": "tests/"
},

`src` and `tests` folders are at the root of my module.

Anyone can tell me what's wrong?

Thank you!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...