Migration Tests
This is a overview of the types of migration tests in Drupal core.
Source plugin tests
These are Kernel tests at core/modules/module_name/tests/src/Kernel/Plugin/migrate/source. If you are writing a source plugin tests then reading \Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d7\VocabularyTest and \Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d7\TermTest is a good place to start.
Process plugin tests
These can be Unit or Kernel tests. There core process plugin unit tests for the Migrate module are at core/migrate/tests/src/Unit/process. The NullCoalesceTest is a good example to start with. There core process plugin Kernel tests for the Migrate module are at core/migrate/tests/src/Kernel/process.
Migration tests
This name usually refers to a Kernel test of a config or content entity migration that loads a source test fixture and then runs all the dependent migrations before asserting the results. These tests use Drupal 6 and Drupal 7 database test fixtures, in the Migrate Drupal module. The tests of migration of node types, \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTypeTest, is a good example to start with.
Migrate UI tests
These are functional tests of the Migrate UI. Currently that is the form at /upgrade. These tests use Drupal 6 and Drupal 7 database test fixtures, in the Migrate Drupal module. A test that runs the complete migration from the UI is \Drupal\Tests\migrate_drupal_ui\Functional\d7\Upgrade7Test.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.