NOTE: This is a technical subticket of T328075: Move tracking out of donation data blob
Context
T336848: Change how the donation bounded context stores tracking data added a new table and additional columns for storing tracking. We need to reflect these changes in the fixture data of the Fundraising Operation center. We need the fixtures when PHPUnit prepares the database for tests. We need to add dedicated DonationTracking entities to the example donations and modify the SQL files with the example data.
Affected repositories
- Fundraising Operation Center
Implementation details
Adding Doctrine Entities
- Look through the file tests/Fixtures/Doctrine/Donations.php.
- Check all different instances of the tracking value in the data blob. (To get a list of unique instances, you can use the command line grep tracking tests/Fixtures/Doctrine/Donations.php | sort | uniq )
- Create the file tests/Fixtures/Doctrine/DonationTracking.php with different static factory functions for each of the tracking values. DO NOT create a factory function for the empty tracking (empty string in Donations.php)!
- Add a call to setDonationTracking in each of the factory functions of Donations.php. Make sure that you are using the matching factory function for the tracking value in the data blob
Leave the tracking data as a duplicate in the donation "data blob". We need it for backwards compatibility until we have refactored all code in the Fundraising Operation Center
Migrating the fixture data in SQL files
For the SQL files tests/Fixtures/Analysis/spenden.sql and tests/Fixtures/Analysis/spenden_wpde.sql do each of the following steps:
- Empty your database.
- Load the SQL file into the empty database
- Run the data migration from T336846: Migrate donation tracking data to new table on the database. The migration script will create entries in the donation_tracking table. See T390996: Integrate Donation tracking changes in Fundraising Application on how to run the data migration. (NOTE: This is about the data migration, the table structure of the FOC is already migrated!)
- Export a new version of the SQL file using mysqldump. Make sure to dump both the spenden and the donation_tracking table, e.g. mysqldump fundraising spenden donation_tracking