2

I have setup integration tests for app/code that was working fine.

Now I have a module that adds some product attributes in a setup script, it doesn't have any tests but it is part of the project. When running integration tests it will fail with the exception: Wrong entity ID

This happens when the setup does this:
$eavSetup->addAttribute(Product::ENTITY, $attributeCode, $attributeDefinition);

The error happens because table eav_entity_type is empty for some reason. what am I missing something here?

2

If you have <const name="TESTS_CLEANUP" value="enabled"/> in your phpunit.xml (which is the default), Magento starts the test suite with an empty database and runs all setup scripts.

In your case, it looks like the setup script of the custom module runs before the one of Magento_Catalog which adds the product type to eav_entity_type.

To overcome this, add Magento_Catalog as a module dependency.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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