Reputation: 708
I want to configure a custom namespace for my tests but I get an error when lauching composer install in prod env
Here relevants parts of my config :
# config/services.yaml
Tests\:
resource: '../tests/'
exclude: '../tests/bootstrap.php'
# composer.json
"autoload": {
"psr-4": {
"App\\": "src/",
"App\\Fixtures\\" : "fixtures/",
"SymfonyStandard\\": "_archives/app/SymfonyStandard/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
# tests/AbstractWebTest.php
namespace Tests;
[...]
abstract class AbstractWebTest extends WebTestCase
{
}
The error I get whith composer
$ composer install --no-dev --optimize-autoloader
!! In FileLoader.php line 174:
!!
!! Expected to find class "Tests\AbstractWebTest" in file "/project_dir/tests/AbstractWebTest.php" while importing services from resource
!! "../tests/", but it was not found! Check the namespace prefix used with the
!! resource in /project_dir/config/services.yaml (which is being
!! imported from "/project_dir/src/Kernel.php").
!!
!!
!! In FileLoader.php line 224:
!!
!! Expected to find class "Tests\AbstractWebTest" in file "/project_dir/tests/AbstractWebTest.php" while importing services from resource
!! "../tests/", but it was not found! Check the namespace prefix used with the
!! resource.
Note : src/Kernel.php is the default file with no changes
What I already tried :
Upvotes: -1
Views: 26