poll migrate support
The migration involves multiple steps: Migrations
- Importing the configuration. Done in 4 steps :
- poll_field_storage_config to create the Field storage.
- poll_field_instance to attach the entity to the poll node.
- poll_field_instance_display for the default view mode display
- poll_field_instance_form_display for the form display.
- Import poll choices. Done in the Poll_choice migration
- Create a poll entity for each poll. Created in poll_question migration
- Create a reference on the poll node to the poll question. Done in poll_reference migration
- import the votes. Done in the poll_vote migration Tests
For the tests, migrate fixtures are included. The test uses MigrateDrupal7TestBase which already imports the standard drupal7 fixtures from core. Only the additional fixtures for poll are needed to be added on top of that.
I followed the guide at https://www.drupal.org/docs/drupal-apis/migrate-api/generating-database-fixtures-for-migration-tests to create the fixtures:
- I used existing fixtures to set up a drupal 7 website.
- After importing the Drupal 7 fixtures I logged in and created the polls via the UI, with relevant options and then I voted on them via the UI.
- I used the script to create a dump of the foixtures. Following this I deleted all previous data that is in the core drupal 7 fixtures, only leaving the additions.
- This would work until there was a change to core fixtures which required bumping the nid and vid to greater than what was added to core, but causedAs this caused nid and vid collisions whenever new data was added to the coredrupal 7 fixtures
- I manually modified the poll fixtures for the nid and vid to start at arbitrarily high numbers (101 on each).
- I manually added a fixture to update system table and mark poll module as enabled.
Closes #2638406
Edited by naheemsays