Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename console command Test to LookupTest #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

peterjaap
Copy link

@peterjaap peterjaap commented Sep 29, 2022

In our pipeline, we ran into this error;

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.

@peterjaap
Copy link
Author

@Hexmage @lewisvoncken ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant