--- /dev/null
+<?php
+
+/**
+ * @file
+ * Module file for workflow_type_test.
+ */
+
+/**
+ * Implements hook_workflow_type_info_alter().
+ */
+function workflow_type_test_workflow_type_info_alter(&$definitions) {
+ // Allow tests to override the workflow type definitions.
+ $state = \Drupal::state();
+ if ($state->get('workflow_type_test.plugin_definitions') !== NULL) {
+ $definitions = $state->get('workflow_type_test.plugin_definitions');
+ }
+}
+
+/**
+ * Sets the type plugin definitions override and clear the cache.
+ *
+ * @param array $definitions
+ * Definitions to set.
+ */
+function workflow_type_test_set_definitions($definitions) {
+ \Drupal::state()->set('workflow_type_test.plugin_definitions', $definitions);
+ \Drupal::service('plugin.manager.workflows.type')->clearCachedDefinitions();
+}