Codeception: "... does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0."

Created on 24 Aug 2020  路  4Comments  路  Source: Codeception/Codeception

I'm receiving a lot of deprecation notices from Composer that relates to Codeception:

Deprecation Notice: Class App\Tests\ExampleTest located in ./tests/unit/ExampleTest.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\Tests\Entity\EmailTest located in ./tests/unit/Entity/EmailTest.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\Tests\AcceptanceTester located in ./tests/_support/AcceptanceTester.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\Tests\FunctionalTester located in ./tests/_support/FunctionalTester.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\Tests\UnitTester located in ./tests/_support/UnitTester.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\Tests\Helper\Functional located in ./tests/_support/Helper/Functional.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\Tests\Helper\Unit located in ./tests/_support/Helper/Unit.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\Tests\Helper\Acceptance located in ./tests/_support/Helper/Acceptance.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201

Is it normal? I can configure manually autoload-dev in composer.json but... is this correct?

This is the first time I use Codeception, so I don't know well how to proceed.

Most helpful comment

Your tests are in the tests (lowercase) subdirectory, but your namespace contains a Tests (capitalized) sub-namespace.
This does not comply with PSR-4 standards - or is App\\Tests\\ your basepath which maps to the tests folder?

All 4 comments

Your tests are in the tests (lowercase) subdirectory, but your namespace contains a Tests (capitalized) sub-namespace.
This does not comply with PSR-4 standards - or is App\\Tests\\ your basepath which maps to the tests folder?

@simonhammes , the problem is not the tests folder: it is mapped in composer.json.

The problem is primarily with the files and folder managed/created by Codeception.

For example ./tests/_support/FunctionalTester.php.

The question is: should have I map manually them? The docs says that a manual mapping is not required as Codeception works out of the box.

@Aerendir My bad, I only looked at the first two lines of the output 馃槾

Have a look at this thread (if you haven't already): https://github.com/Codeception/Codeception/issues/5727

@simonhammes , thank you for the reference: it is exactly the same problem!

I'm going to close this issue as this is a duplicate.

Was this page helpful?
0 / 5 - 0 ratings