Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / migrate_plus / tests / src / Kernel / MigrateTableTest.php
index 56c8b7ada1372efe25565241b77382d16991a19f..dc471770d711668f07e7e8fe2b136388e753b9f2 100755 (executable)
@@ -4,7 +4,6 @@ namespace Drupal\Tests\migrate_plus\Kernel;
 
 use Drupal\Core\Database\Database;
 use Drupal\migrate\MigrateExecutable;
-use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\Tests\migrate\Kernel\MigrateTestBase;
 
 /**
@@ -17,12 +16,17 @@ class MigrateTableTest extends MigrateTestBase {
   const TABLE_NAME = 'migrate_test_destination_table';
 
   /**
+   * The database connection.
+   *
    * @var \Drupal\Core\Database\Connection
    */
   protected $connection;
 
   public static $modules = ['migrate_plus'];
 
+  /**
+   * {@inheritdoc}
+   */
   protected function setUp() {
     parent::setUp();
 
@@ -51,22 +55,42 @@ class MigrateTableTest extends MigrateTestBase {
     ]);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   protected function tearDown() {
     $this->connection->schema()->dropTable(static::TABLE_NAME);
     parent::tearDown();
   }
 
+  /**
+   * Create a minimally valid migration with some source data.
+   *
+   * @return array
+   *   The migration definition.
+   */
   protected function getTableDestinationMigration() {
-    // Create a minimally valid migration with some source data.
     $definition = [
       'id' => 'migration_table_test',
       'migration_tags' => ['Testing'],
       'source' => [
         'plugin' => 'embedded_data',
         'data_rows' => [
-          ['data' => 'dummy value', 'data2' => 'dummy2 value', 'data3' => 'dummy3 value'],
-          ['data' => 'dummy value2', 'data2' => 'dummy2 value2', 'data3' => 'dummy3 value2'],
-          ['data' => 'dummy value3', 'data2' => 'dummy2 value3', 'data3' => 'dummy3 value3'],
+          [
+            'data' => 'dummy value',
+            'data2' => 'dummy2 value',
+            'data3' => 'dummy3 value',
+          ],
+          [
+            'data' => 'dummy value2',
+            'data2' => 'dummy2 value2',
+            'data3' => 'dummy3 value2',
+          ],
+          [
+            'data' => 'dummy value3',
+            'data2' => 'dummy2 value3',
+            'data3' => 'dummy3 value3',
+          ],
         ],
         'ids' => [
           'data' => ['type' => 'string'],
@@ -107,10 +131,13 @@ class MigrateTableTest extends MigrateTestBase {
     $this->assertEquals(3, count($values));
   }
 
+  /**
+   * Tests table rollback.
+   */
   public function testTableRollback() {
     $this->testTableDestination();
 
-    /** @var MigrationInterface $migration */
+    /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
     $migration = \Drupal::service('plugin.manager.migration')->createStubMigration($this->getTableDestinationMigration());
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();