0

I am trying to inject a model via Object Manager in an integration test. The injection/creation of object takes forever and never ends. However, when I try print_r before calling get/create on object manager instance, I see the dump response on the console and test ends so the issue is clearly not with the tests not running but rather with Object manager creation.

class RemoveAbandonedCartDataOlderThanAMonthCronTest extends AbstractController {

/**
 * @var Abc\AbandonedCart\Cron\RemoveAbandonedCartDataOlderThanAMonthCron
 */
private $cron;

/**
 * @var Magento\Framework\App\ResourceConnection
 */
private $resourceConnection;

protected function setUp() {
    parent::setUp();

    $this->resourceConnection = $this->_objectManager->get('Abc\AbandonedCart\Model\AbandonedCart');
 }
}

enter image description here

magento/product-community-edition: 2.3.5

Any help would be greatly appreciated. Thanks

1 Answer 1

1

However, this might seems awkward but the issue was fixed with scope resolution operator.

$this->_objectManager->get(\Abc\AbandonedCart\Model\AbandonedCart::class);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.