Original composer.json
"autoload": {
    "psr-4": { "": "src/" },
    "classmap": [ "app/AppKernel.php", "app/AppCache.php" ],
    "exclude-from-classmap": [ "/tests/" ]
},
"autoload-dev": {
    "psr-4": { "tests\\": "tests/" }
}
New composer.json
"autoload": {
    "psr-4": {
        "AppBundle\\": "src/AppBundle",
        "TOTO\\": "src/TOTO"
    },
    "classmap": [
        "app/AppKernel.php",
        "app/AppCache.php" ],
    "exclude-from-classmap": [ "/tests/" ]
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    },
    "files": [
        "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
    ]
},
My trait is defined in tests\TOTO\Services\InvokeMethodTrait and is called by other tests such as tests\TOTO\Services\ConversationServiceTest, since that change for optimizing the autoloader I get Fatal error: Trait 'tests\TOTO\Services\InvokeMethodTrait' not found in /var/www/symfony/tests/TOTO/Services/ConversationServiceTest.php on line 17. It was working properly before and I didn't change anything in the related classes.
Any idea?
 
    