PHP Fatal error: Uncaught Error: Class 'Magento\Framework\Component\ComponentRegistrar' not found in /home/ubuntu/custom-module/registration.php:6
Stack trace:
#0 /home/ubuntu/custom-module/vendor/composer/autoload_real.php(66): require()
#1 /home/ubuntu/custom-module/vendor/composer/autoload_real.php(56): composerRequiref6475a93b986d5b841accb13703f079a('bdaf00c9b7defe0...', '/home/ubuntu/ma...')
#2 /home/ubuntu/custom-module/vendor/autoload.php(7): ComposerAutoloaderInitf6475a93b986d5b841accb13703f079a::getLoader()
#3 /home/ubuntu/custom-module/vendor/phpunit/phpunit/phpunit(45): require('/home/ubuntu/ma...')
#4 {main}
Stack trace: #0 /home/ubuntu/custom-module/vendor/composer/autoload_real.php(66): require() #1 /home/ubuntu/custom-module/vendor/composer/autoload_real.php(56): composerRequiref6475a93b986d5b841accb13703f079a('bdaf00c9b7defe0...', '/home/ubuntu/ma...') #2 /home/ubuntu/custom-module/vendor/autoload.php(7): ComposerAutoloaderInitf6475a93b986d5b841accb13703f079a::getLoader() #3 /home/ubuntu/custom-module/vendor/phpunit/phpunit/phpunit(45): require('/home/ubuntu/ma...') #4 {main} thrownthrown in /home/ubuntu/mage2-private-products/registration.php on line 6
- Should I omit the
registration.php
from mycomposer.json
-file?Should I omit theregistration.php
from mycomposer.json
-file? - Should I include the complete Magento framework as dev-dependency? (I don't think so because my unit tests should mock everything).
- Should I wrap my register function with a
if class_exists()
? - Some other solution / suggestion?
What are other peoples experiences / best practices when it comes to individual module testing / CI processes with Magento 2?
Edit: I found out that if I omit my registration.php
autoload in my composer.json
, that Magento 2 will not see my module (which makes sense). For now I've included the Magento Framework (magento/framework
) as a development dependency and added an auth.json
for the credentials. I guess that's the best way to do this, but I'm still interested in other peoples' experiences.