clean install

This commit is contained in:
2024-12-10 15:08:16 +01:00
commit e14eb2d8fd
31193 changed files with 3555714 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
name: Test display of migrate message
type: module
description: Tests the display of migrate messages.
package: Testing
version: VERSION

View File

@@ -0,0 +1,13 @@
id: custom_test
label: Test display of upgrade messages
source:
plugin: embedded_data
data_rows:
- id: 0
ids:
id:
type: integer
process:
id: id
destination:
plugin: null

View File

@@ -0,0 +1,9 @@
id: custom_test_db
label: Test display of upgrade messages
source:
plugin: extension
name: i18n_menu
process:
id: id
destination:
plugin: null

View File

@@ -0,0 +1,5 @@
name: Cacheable Embedded Data Test
type: module
description: Module containing a cacheable embedded data source.
package: Testing
version: VERSION

View File

@@ -0,0 +1,33 @@
<?php
namespace Drupal\migrate_cache_counts_test\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\EmbeddedDataSource;
use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
/**
* A copy of embedded_data which allows caching the count.
*
* @MigrateSource(
* id = "cacheable_embedded_data",
* source_module = "migrate"
* )
*/
class CacheableEmbeddedDataSource extends EmbeddedDataSource {
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function count($refresh = FALSE) {
return SourcePluginBase::count($refresh);
}
/**
* {@inheritdoc}
*/
protected function doCount() {
return parent::count(TRUE);
}
}

View File

@@ -0,0 +1,5 @@
name: 'Migrate entity test'
type: module
description: 'Support module for entity destination test.'
package: Testing
version: VERSION

View File

@@ -0,0 +1,36 @@
<?php
namespace Drupal\migrate_entity_test\Entity;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Defines a content entity type that has a string ID.
*
* @ContentEntityType(
* id = "migrate_string_id_entity_test",
* label = @Translation("String id entity test"),
* base_table = "migrate_entity_test_string_id",
* entity_keys = {
* "id" = "id",
* }
* )
*/
class StringIdEntityTest extends ContentEntityBase {
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
return [
'id' => BaseFieldDefinition::create('integer')
->setSetting('size', 'big')
->setLabel('ID'),
'version' => BaseFieldDefinition::create('string')
->setLabel('Version'),
];
}
}

View File

@@ -0,0 +1,4 @@
name: 'Migrate events test'
type: module
package: Testing
version: VERSION

View File

@@ -0,0 +1,40 @@
<?php
namespace Drupal\migrate_events_test\Plugin\migrate\destination;
use Drupal\migrate\Attribute\MigrateDestination;
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
use Drupal\migrate\Row;
/**
* Migration dummy destination.
*/
#[MigrateDestination(
id: 'dummy',
requirements_met: TRUE
)]
class DummyDestination extends DestinationBase {
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['value']['type'] = 'string';
return $ids;
}
/**
* {@inheritdoc}
*/
public function fields() {
return ['value' => 'Dummy value'];
}
/**
* {@inheritdoc}
*/
public function import(Row $row, array $old_destination_id_values = []) {
return ['value' => $row->getDestinationProperty('value')];
}
}

View File

@@ -0,0 +1,7 @@
name: 'Migration Expected Migrations Test'
type: module
description: 'Provides test migrations to test getMigrationDependencies.'
package: Testing
version: VERSION
dependencies:
- drupal:migrate

View File

@@ -0,0 +1,7 @@
id: m1
label: "Sample Migration 1"
source:
plugin: empty
process: {}
destination:
plugin: 'null'

View File

@@ -0,0 +1,7 @@
id: m2
label: "Sample Migration 2"
source:
plugin: empty
process: {}
destination:
plugin: 'null'

View File

@@ -0,0 +1,7 @@
id: m3
label: "Sample Migration 3"
source:
plugin: empty
process: {}
destination:
plugin: 'null'

View File

@@ -0,0 +1,7 @@
id: m4
label: "Sample Migration 4"
source:
plugin: empty
process: {}
destination:
plugin: 'null'

View File

@@ -0,0 +1,7 @@
id: m5
label: "Sample Migration 5"
source:
plugin: empty
process: {}
destination:
plugin: 'null'

View File

@@ -0,0 +1,7 @@
name: 'Migration external translated test'
type: module
package: Testing
version: VERSION
dependencies:
- drupal:node
- drupal:migrate

View File

@@ -0,0 +1,19 @@
id: external_translated_test_node
label: External translated content
source:
plugin: migrate_external_translated_test
default_lang: true
constants:
type: external_test
process:
type: constants/type
title: title
langcode:
plugin: static_map
source: lang
map:
English: en
French: fr
Spanish: es
destination:
plugin: entity:node

View File

@@ -0,0 +1,27 @@
id: external_translated_test_node_translation
label: External translated content translations
source:
plugin: migrate_external_translated_test
default_lang: false
constants:
type: external_test
process:
nid:
plugin: migration_lookup
source: name
migration: external_translated_test_node
type: constants/type
title: title
langcode:
plugin: static_map
source: lang
map:
English: en
French: fr
Spanish: es
destination:
plugin: entity:node
translations: true
migration_dependencies:
required:
- external_translated_test_node

View File

@@ -0,0 +1,78 @@
<?php
namespace Drupal\migrate_external_translated_test\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
/**
* A simple migrate source for our tests.
*
* @MigrateSource(
* id = "migrate_external_translated_test",
* source_module = "migrate_external_translated_test"
* )
*/
class MigrateExternalTranslatedTestSource extends SourcePluginBase {
/**
* The data to import.
*
* @var array
*/
protected $import = [
['name' => 'cat', 'title' => 'Cat', 'lang' => 'English'],
['name' => 'cat', 'title' => 'Chat', 'lang' => 'French'],
['name' => 'cat', 'title' => 'es - Cat', 'lang' => 'Spanish'],
['name' => 'dog', 'title' => 'Dog', 'lang' => 'English'],
['name' => 'dog', 'title' => 'fr - Dog', 'lang' => 'French'],
['name' => 'monkey', 'title' => 'Monkey', 'lang' => 'English'],
];
/**
* {@inheritdoc}
*/
public function fields() {
return [
'name' => $this->t('Unique name'),
'title' => $this->t('Title'),
'lang' => $this->t('Language'),
];
}
/**
* {@inheritdoc}
*/
public function __toString() {
return '';
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['name']['type'] = 'string';
if (!$this->configuration['default_lang']) {
$ids['lang']['type'] = 'string';
}
return $ids;
}
/**
* {@inheritdoc}
*/
protected function initializeIterator() {
$data = [];
// Keep the rows with the right languages.
$want_default = $this->configuration['default_lang'];
foreach ($this->import as $row) {
$is_english = $row['lang'] == 'English';
if ($want_default == $is_english) {
$data[] = $row;
}
}
return new \ArrayIterator($data);
}
}

View File

@@ -0,0 +1,9 @@
langcode: en
status: true
name: High Water import node
type: high_water_import_node
description: null
help: null
new_revision: false
preview_mode: 1
display_submitted: true

View File

@@ -0,0 +1,6 @@
type: module
name: Migration High Water Test
description: 'Provides test fixtures for testing high water marks.'
package: Testing
dependencies:
- drupal:migrate

View File

@@ -0,0 +1,16 @@
id: high_water_test
label: High water test.
source:
plugin: high_water_test
high_water_property:
name: changed
destination:
plugin: entity:node
migration_tags:
test: test
process:
changed: changed
title: title
type:
plugin: default_value
default_value: high_water_import_node

View File

@@ -0,0 +1,54 @@
<?php
namespace Drupal\migrate_high_water_test\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Source plugin for migration high water tests.
*
* @MigrateSource(
* id = "high_water_test"
* )
*/
class HighWaterTest extends SqlBase {
/**
* {@inheritdoc}
*/
public function query() {
$field_names = array_keys($this->fields());
$query = $this
->select('high_water_node', 'm')
->fields('m', $field_names);
foreach ($field_names as $field_name) {
$query->groupBy($field_name);
}
return $query;
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'id' => $this->t('Id'),
'title' => $this->t('Title'),
'changed' => $this->t('Changed'),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function getIds() {
return [
'id' => [
'type' => 'integer',
],
];
}
}

View File

@@ -0,0 +1,7 @@
name: 'Migration Lookup Test'
type: module
description: 'Provides test migrations to test migration lookup service.'
package: Testing
version: VERSION
dependencies:
- drupal:migrate

View File

@@ -0,0 +1,20 @@
id: sample_lookup_migration
label: Sample Lookup Migration
source:
plugin: embedded_data
data_rows:
- id: 17
nid: 1
title: Node 1
- id: 25
nid: 2
title: Node 2
ids:
id:
type: integer
process:
nid: nid
title: title
destination:
default_bundle: node_lookup
plugin: entity:node

View File

@@ -0,0 +1,20 @@
id: sample_lookup_migration_2
label: Sample Lookup Migration
source:
plugin: embedded_data
data_rows:
- id: 27
nid: 3
title: Node 3
- id: 35
nid: 4
title: Node 4
ids:
id:
type: integer
process:
nid: nid
title: title
destination:
default_bundle: node_lookup
plugin: entity:node

View File

@@ -0,0 +1,28 @@
id: sample_lookup_migration_multiple_source_ids
label: "Sample Lookup Migration With Multiple Source Ids."
source:
plugin: embedded_data
data_rows:
- id: 17
version_id: 17
nid: 1
title: "Node 1"
- id: 25
version_id: 25
nid: 2
title: "Node 2"
- id: 25
version_id: 26
nid: 3
title: "Node 3"
ids:
id:
type: integer
version_id:
type: integer
process:
nid: nid
title: title
destination:
default_bundle: node_lookup
plugin: entity:node

View File

@@ -0,0 +1,20 @@
id: sample_lookup_migration_string_ids
label: Sample Lookup Migration with string ids
source:
plugin: embedded_data
data_rows:
- id: node1
nid: 10
title: Node 10
- id: node2
nid: 11
title: Node 11
ids:
id:
type: string
process:
nid: nid
title: title
destination:
default_bundle: node_lookup
plugin: entity:node

View File

@@ -0,0 +1,6 @@
name: 'Migration missing database test'
type: module
package: Testing
version: VERSION
dependencies:
- drupal:migrate

View File

@@ -0,0 +1,8 @@
id: missing_database
label: Migration using a SQL source
source:
plugin: migrate_missing_database_test
process: {}
destination:
plugin: 'null'
migration_dependencies: {}

View File

@@ -0,0 +1,52 @@
<?php
namespace Drupal\migrate_missing_database_test\Plugin\migrate\source;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* A simple migrate source for the missing database tests.
*
* @MigrateSource(
* id = "migrate_missing_database_test",
* source_module = "migrate_missing_database_test",
* requirements_met = true
* )
*/
class MigrateMissingDatabaseSource extends SqlBase {
/**
* {@inheritdoc}
*/
public function query(): SelectInterface {
$field_names = ['id'];
$query = $this
->select('missing_database', 'm')
->fields('m', $field_names);
return $query;
}
/**
* {@inheritdoc}
*/
public function fields(): array {
$fields = [
'id' => $this->t('ID'),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function getIds(): array {
return [
'id' => [
'type' => 'integer',
],
];
}
}

View File

@@ -0,0 +1,8 @@
name: 'Migrate No Migrate Drupal Test'
type: module
description: Provides fixture for testing without migrate_drupal.
package: Testing
version: VERSION
dependencies:
- drupal:migrate
- drupal:node

View File

@@ -0,0 +1,7 @@
migrate_no_migrate_drupal_test.execute:
path: '/migrate_no_migrate_drupal_test/execute'
defaults:
_controller: '\Drupal\migrate_no_migrate_drupal_test\Controller\ExecuteMigration::execute'
_title: 'Execute'
requirements:
_access: 'TRUE'

View File

@@ -0,0 +1,22 @@
id: node_migration_no_migrate_drupal
label: Node Migration No Migrate Drupal
source:
plugin: embedded_data
data_rows:
-
id: 1
nid: 1
title: Node 1
-
id: 2
nid: 2
title: Node 2
ids:
id:
type: integer
process:
nid: nid
title: title
destination:
default_bundle: no_migrate_drupal
plugin: entity:node

View File

@@ -0,0 +1,45 @@
<?php
namespace Drupal\migrate_no_migrate_drupal_test\Controller;
use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
use Drupal\Core\Controller\ControllerBase;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate\Plugin\MigrationInterface;
/**
* Custom controller to execute the test migrations.
*
* This controller class is required for the proper functional testing of
* migration dependencies. Otherwise, the migration directly executed from the
* functional test would use the functional test's class map and autoloader. The
* functional test has all the classes available to it but the controller
* does not.
*/
class ExecuteMigration extends ControllerBase {
/**
* Run the node_migration_no_migrate_drupal test migration.
*
* @return array
* A renderable array.
*/
public function execute() {
$migration_plugin_manager = \Drupal::service('plugin.manager.migration');
$definitions = $migration_plugin_manager->getDefinitions();
if ($definitions['node_migration_no_migrate_drupal']['label'] !== 'Node Migration No Migrate Drupal') {
throw new InvalidPluginDefinitionException('node_migration_no_migrate_drupal');
}
$migrations = $migration_plugin_manager->createInstances('node_migration_no_migrate_drupal');
$result = (new MigrateExecutable($migrations['node_migration_no_migrate_drupal']))->import();
if ($result !== MigrationInterface::RESULT_COMPLETED) {
throw new \RuntimeException('Migration failed');
}
return [
'#type' => 'markup',
'#markup' => 'Migration was successful.',
];
}
}

View File

@@ -0,0 +1,5 @@
name: 'Migrate module prepareRow tests'
type: module
description: 'Support module for source plugin prepareRow testing.'
package: Testing
version: VERSION

View File

@@ -0,0 +1,27 @@
<?php
/**
* @file
* Tests the migration source plugin prepareRow() exception handling.
*/
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\MigrateSourceInterface;
use Drupal\migrate\Row;
/**
* Implements hook_migrate_prepare_row().
*/
function migrate_prepare_row_test_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
// Test both options for save_to_map.
$data = $row->getSourceProperty('data');
if ($data == 'skip_and_record') {
// Record mapping but don't record a message.
throw new MigrateSkipRowException('', TRUE);
}
elseif ($data == 'skip_and_do_not_record') {
// Don't record mapping but record a message.
throw new MigrateSkipRowException('skip_and_do_not_record message', FALSE);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Drupal\migrate_prepare_row_test\Plugin\migrate\process;
use Drupal\migrate\Attribute\MigrateProcess;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
/**
* Provides a testing process plugin that skips rows.
*/
#[MigrateProcess('test_skip_row_process')]
class TestSkipRowProcess extends ProcessPluginBase {
/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
// Test both options for save_to_map.
$data = $row->getSourceProperty('data');
if ($data == 'skip_and_record (use plugin)') {
throw new MigrateSkipRowException('', TRUE);
}
elseif ($data == 'skip_and_do_not_record (use plugin)') {
throw new MigrateSkipRowException('', FALSE);
}
return $value;
}
}

View File

@@ -0,0 +1,6 @@
type: module
name: Migrate query batch Source test
description: 'Provides a database table and records for SQL import with batch testing.'
package: Testing
dependencies:
- drupal:migrate

View File

@@ -0,0 +1,45 @@
<?php
namespace Drupal\migrate_query_batch_test\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Source plugin for migration high water tests.
*
* @MigrateSource(
* id = "query_batch_test"
* )
*/
class QueryBatchTest extends SqlBase {
/**
* {@inheritdoc}
*/
public function query() {
return ($this->select('query_batch_test', 'q')->fields('q'));
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'id' => $this->t('Id'),
'data' => $this->t('data'),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function getIds() {
return [
'id' => [
'type' => 'integer',
],
];
}
}

View File

@@ -0,0 +1,5 @@
name: 'Migrate module prepareRow tests'
type: module
description: 'Support module for source plugin prepareRow testing.'
package: Testing
version: VERSION

View File

@@ -0,0 +1,20 @@
<?php
/**
* @file
* Tests the migration source plugin prepareRow() exception.
*/
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\MigrateSourceInterface;
use Drupal\migrate\Row;
/**
* Implements hook_migrate_prepare_row().
*/
function migrate_skip_all_rows_test_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
if (\Drupal::state()->get('migrate_skip_all_rows_test_migrate_prepare_row')) {
throw new MigrateSkipRowException();
}
}

View File

@@ -0,0 +1,4 @@
type: module
name: Migrate SqlBase count cache test
description: Provides a source plugin to test that counts are cached in SQL sources.
package: Testing

View File

@@ -0,0 +1,43 @@
<?php
namespace Drupal\migrate_sql_count_cache_test\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Source plugin for Sql count cache test.
*
* @MigrateSource(
* id = "sql_count_cache"
* )
*/
class SqlCountCache extends SqlBase {
/**
* {@inheritdoc}
*/
public function fields() {
return [
'id' => $this->t('Id'),
];
}
/**
* {@inheritdoc}
*/
public function getIds() {
return [
'id' => [
'type' => 'integer',
],
];
}
/**
* {@inheritdoc}
*/
public function query() {
return $this->select('source_table', 's')->fields('s', ['id']);
}
}

View File

@@ -0,0 +1,7 @@
name: 'Migration Stub Test'
type: module
description: 'Provides test migrations to test migration stub service.'
package: Testing
version: VERSION
dependencies:
- drupal:migrate

View File

@@ -0,0 +1,25 @@
id: sample_stubbing_migration
label: "Sample Stubbing Migration"
source:
plugin: embedded_data
data_rows:
- id: 17
title: "Sample 1"
body_value: "This is the body for ID 17"
body_format: "plain_text"
- id: 25
title: "Sample 2"
body_value: "This is the body for ID 25"
body_format: "plain_text"
- id: 33
title: "Sample 3"
ids:
id:
type: integer
process:
title: title
body/0/value: body_value
body/0/format: body_format
destination:
default_bundle: node_stub
plugin: entity:node

View File

@@ -0,0 +1,27 @@
id: sample_stubbing_migration_with_multiple_source_ids
label: "Sample stubbing migration with multiple source ids."
source:
plugin: embedded_data
data_rows:
- id: 17
version_id: 17
title: "Sample 1"
body_value: "This is the body for ID 17"
body_format: "plain_text"
- id: 25
version_id: 25
title: "Sample 2"
body_value: "This is the body for ID 25"
body_format: "plain_text"
ids:
id:
type: integer
version_id:
type: integer
process:
title: title
body/0/value: body_value
body/0/format: body_format
destination:
default_bundle: node_stub
plugin: entity:node

View File

@@ -0,0 +1,7 @@
name: Migration Tag Test
type: module
description: Provide migrations for testing 'migration_tags' property
package: Testing
version: VERSION
dependencies:
- drupal:migrate

View File

@@ -0,0 +1,16 @@
id: tag_test_0
label: migration tag test 0
migration_tags:
- test
- tag_test_0
source:
plugin: embedded_data
data_rows:
- id: 0
ids:
id:
type: integer
process:
id: id
destination:
plugin: null

View File

@@ -0,0 +1,16 @@
id: tag_test_1
label: migration tag test 1
migration_tags:
- test
- tag_test_1
source:
plugin: embedded_data
data_rows:
- id: 0
ids:
id:
type: integer
process:
id: id
destination:
plugin: null

View File

@@ -0,0 +1,13 @@
id: tag_test_no_tag
label: migration tag test no tags
source:
plugin: embedded_data
data_rows:
- id: 0
ids:
id:
type: integer
process:
id: id
destination:
plugin: null

View File

@@ -0,0 +1,8 @@
langcode: en
status: true
dependencies: { }
name: Track changes import term
vid: track_changes_import_term
description: ''
weight: 0
new_revision: false

View File

@@ -0,0 +1,6 @@
type: module
name: Migration Track Changes Test
description: 'Provides test fixtures for testing track changes marks.'
package: Testing
dependencies:
- drupal:migrate

View File

@@ -0,0 +1,19 @@
id: track_changes_test
label: Track changes test.
source:
plugin: track_changes_test
track_changes: true
batch_size: 1
destination:
plugin: entity:taxonomy_term
migration_tags:
test: test
process:
name: name
vid:
plugin: default_value
default_value: track_changes_import_term
'description/value': description
'description/format':
plugin: default_value
default_value: 'basic_html'

View File

@@ -0,0 +1,54 @@
<?php
namespace Drupal\migrate_track_changes_test\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Source plugin for migration track changes tests.
*
* @MigrateSource(
* id = "track_changes_test"
* )
*/
class TrackChangesTest extends SqlBase {
/**
* {@inheritdoc}
*/
public function query() {
$field_names = array_keys($this->fields());
$query = $this
->select('track_changes_term', 't')
->fields('t', $field_names);
foreach ($field_names as $field_name) {
$query->groupBy($field_name);
}
return $query;
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'tid' => $this->t('Term id'),
'name' => $this->t('Name'),
'description' => $this->t('Description'),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function getIds() {
return [
'tid' => [
'type' => 'integer',
],
];
}
}