PHP Fatal error: Uncaught Error: Class "Experius\Postcode\Console\Command\Test\Interceptor" not found in /data/web/releases/20220929141143/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121
For extra security, we run composer dump --classmap-authoritative in our pipeline, creating a classmap for all classes in the project. However, Magento by default excludes Tests from the classmap, see here.
This usually isn't a problem since Tests shouldn't be referenced by production code anyway. However in this case, Composer thinks the console command named "Test" is in fact a test, and skips this class when creating the classmap, causing the Uncaught Error Class not found to occur.
Simply renaming Test to something else fixes this. I've named it LookupTest here, since that is what it does. I've kept the command itself (bin/magento experius_postcode:test) the same for backwards compatibility.
In our pipeline, we ran into this error;
For extra security, we run
composer dump --classmap-authoritative
in our pipeline, creating a classmap for all classes in the project. However, Magento by default excludes Tests from the classmap, see here.This usually isn't a problem since Tests shouldn't be referenced by production code anyway. However in this case, Composer thinks the console command named "Test" is in fact a test, and skips this class when creating the classmap, causing the Uncaught Error Class not found to occur.
Simply renaming Test to something else fixes this. I've named it LookupTest here, since that is what it does. I've kept the command itself (
bin/magento experius_postcode:test
) the same for backwards compatibility.