Skip to content

"Cannot instantiate interface Magento\Framework\Interception\ObjectManager\ConfigInterface" error in integration tests #12844

Closed
@schmengler

Description

@schmengler

Preconditions

  1. Magento 2.2.1

Steps to reproduce

  1. Create an integration test with the following fixture:
    protected function setUp()
    {
        $this->objectManager = Bootstrap::getObjectManager();
        $this->commandList = $this->objectManager->create(CommandListInterface::class);
    }

Expected result

  1. I can use the command list to test registered commands

Actual result

  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions