Mercurial > hg > isophonics-drupal-site
annotate core/modules/migrate/tests/src/Kernel/MigrationTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Tests\migrate\Kernel; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\KernelTests\KernelTestBase; |
Chris@0 | 6 |
Chris@0 | 7 /** |
Chris@0 | 8 * Tests the migration plugin. |
Chris@0 | 9 * |
Chris@0 | 10 * @group migrate |
Chris@0 | 11 * |
Chris@0 | 12 * @coversDefaultClass \Drupal\migrate\Plugin\Migration |
Chris@0 | 13 */ |
Chris@0 | 14 class MigrationTest extends KernelTestBase { |
Chris@0 | 15 |
Chris@0 | 16 /** |
Chris@0 | 17 * Enable field because we are using one of its source plugins. |
Chris@0 | 18 * |
Chris@0 | 19 * @var array |
Chris@0 | 20 */ |
Chris@0 | 21 public static $modules = ['migrate', 'field']; |
Chris@0 | 22 |
Chris@0 | 23 /** |
Chris@0 | 24 * Tests Migration::set(). |
Chris@0 | 25 * |
Chris@0 | 26 * @covers ::set |
Chris@0 | 27 */ |
Chris@0 | 28 public function testSetInvalidation() { |
Chris@0 | 29 $migration = \Drupal::service('plugin.manager.migration')->createStubMigration([ |
Chris@0 | 30 'source' => ['plugin' => 'empty'], |
Chris@0 | 31 'destination' => ['plugin' => 'entity:entity_view_mode'], |
Chris@0 | 32 ]); |
Chris@0 | 33 $this->assertEqual('empty', $migration->getSourcePlugin()->getPluginId()); |
Chris@0 | 34 $this->assertEqual('entity:entity_view_mode', $migration->getDestinationPlugin()->getPluginId()); |
Chris@0 | 35 |
Chris@0 | 36 // Test the source plugin is invalidated. |
Chris@0 | 37 $migration->set('source', ['plugin' => 'embedded_data', 'data_rows' => [], 'ids' => []]); |
Chris@0 | 38 $this->assertEqual('embedded_data', $migration->getSourcePlugin()->getPluginId()); |
Chris@0 | 39 |
Chris@0 | 40 // Test the destination plugin is invalidated. |
Chris@0 | 41 $migration->set('destination', ['plugin' => 'null']); |
Chris@0 | 42 $this->assertEqual('null', $migration->getDestinationPlugin()->getPluginId()); |
Chris@0 | 43 } |
Chris@0 | 44 |
Chris@0 | 45 } |