Skip to content
This repository was archived by the owner on May 27, 2023. It is now read-only.
This repository was archived by the owner on May 27, 2023. It is now read-only.

Integrity constraint violation in EcomDev_PHPUnitTest fixture data  #166

Closed

Description

@aligentjim

We're setting up a site with a reasonably complex multi-store structure. We've got a setup script that deletes the standard base website and store view, before creating our own. As a result, there's no website_id/store_id 1 in our database. The fixture loader fails with the following error when loading app/code/community/EcomDev/PHPUnitTest/Test/Helper/_data/fx-customers.yaml:

PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (mysite_test.customer_entity, CONSTRAINT FK_CUSTOMER_ENTITY_STORE_ID_CORE_STORE_STORE_ID FOREIGN KEY (store_id) REFERENCES core_store (store_id) ON DELETE SET NULL ON UPDATE CASCADE)' in /var/www/vhosts/mysite/lib/Zend/Db/Statement/Pdo.php:228

We find that putting all of the required data into fixtures (e.g. default scope, root categories) even if that data would normally be created by core setup scripts leads to more isolated tests.

Activity

  1. IvanChepurnyi commented on Feb 5, 2014

    @IvanChepurnyi
    Member

    EcomDev_PHPUnitTest module is intended to test only EcomDev_PHPUnit functionality on bare Magento install, and it actually disables this module by default, when you installing EcomDev_PHPUnit extension. So you should disable it, if you enabled it occasionally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions