Closed
Description
Preconditions
- Magento 2.2.1
Steps to reproduce
- Create an integration test with the following fixture:
protected function setUp() { $this->objectManager = Bootstrap::getObjectManager(); $this->commandList = $this->objectManager->create(CommandListInterface::class); }
Expected result
- I can use the command list to test registered commands
Actual result
- The test fails with an error like this:
Cannot instantiate interface Magento\Framework\Interception\ObjectManager\ConfigInterface PATH/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50 PATH/vendor/magento/framework/ObjectManager/ObjectManager.php:70 PATH/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:144 PATH/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:230 PATH/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34 PATH/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59 PATH/vendor/magento/framework/ObjectManager/ObjectManager.php:70 PATH/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:144 PATH/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:230 PATH/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34 PATH/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59 PATH/vendor/magento/framework/ObjectManager/ObjectManager.php:70 PATH/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:144 PATH/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:230 PATH/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34 PATH/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59 PATH/vendor/magento/framework/ObjectManager/ObjectManager.php:70 PATH/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:180 PATH/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:156 PATH/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:230 PATH/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34 PATH/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59 PATH/vendor/magento/framework/ObjectManager/ObjectManager.php:56 PATH/vendor/example/example/tests/ExampleTest.php:53
I logged which classes were instantiated befor the error and it seems like XmlCatalogGenerateCommand
has the object manager config in its dependency graph, but in the integration test environment there is no preference for it.
Magento\Developer\Console\Command\XmlCatalogGenerateCommand
=> Magento\Framework\App\Utility\Files
=> Magento\Framework\Component\DirSearch
=> Magento\Framework\App\Utility\RegexIteratorFactory
=> Magento\Developer\Model\XmlCatalog\Format\PhpStorm
=> Magento\Framework\Filesystem\File\WriteFactory
=> Magento\Developer\Console\Command\DiInfoCommand
=> Magento\Developer\Model\Di\Information
=> Magento\Developer\Model\Di\PluginList
=> Magento\Framework\Interception\ObjectManager\ConfigInterface