public function TemplateTest::testGetTemplateByName in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/src/Tests/TemplateTest.php \Drupal\migrate\Tests\TemplateTest::testGetTemplateByName()
Tests retrieving a template by name.
File
- core/
modules/ migrate/ src/ Tests/ TemplateTest.php, line 53 - Contains \Drupal\migrate\Tests\TemplateTest.
Class
- TemplateTest
- Test the migration template functionality.
Namespace
Drupal\migrate\TestsCode
public function testGetTemplateByName() {
/** @var \Drupal\migrate\MigrateTemplateStorage $template_storage */
$template_storage = \Drupal::service('migrate.template_storage');
$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($template_storage
->getTemplateByName('migrate.migration.url_template'), $expected_url);
$this
->assertIdentical($template_storage
->getTemplateByName('migrate.migration.node_template'), $expected_node);
$this
->assertNull($template_storage
->getTemplateByName('migrate.migration.dne'));
}