public function TemplateTest::testTemplates in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/src/Tests/TemplateTest.php \Drupal\migrate\Tests\TemplateTest::testTemplates()
Test different connection types.
File
- core/
modules/ migrate/ src/ Tests/ TemplateTest.php, line 27 - Contains \Drupal\migrate\Tests\TemplateTest.
Class
- TemplateTest
- Test the migration template functionality.
Namespace
Drupal\migrate\TestsCode
public function testTemplates() {
$migration_templates = \Drupal::service('migrate.template_storage')
->findTemplatesByTag("Template Test");
$expected_url = [
'id' => 'url_template',
'label' => 'Template test - url',
'migration_tags' => [
'Template Test',
],
'source' => [
'plugin' => 'empty',
],
'process' => [
'src' => 'foobar',
],
'destination' => [
'plugin' => 'url_alias',
],
];
$expected_node = [
'id' => 'node_template',
'label' => 'Template test - node',
'migration_tags' => [
'Template Test',
],
'source' => [
'plugin' => 'empty',
],
'process' => [
'src' => 'barfoo',
],
'destination' => [
'plugin' => 'entity:node',
],
];
$this
->assertIdentical($migration_templates['migrate.migration.url_template'], $expected_url);
$this
->assertIdentical($migration_templates['migrate.migration.node_template'], $expected_node);
$this
->assertFalse(isset($migration_templates['migrate.migration.other_template']));
}