function MigrateFieldTest::testDatetimeFields

Same name in other branches
  1. 9 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldTest::testDatetimeFields()
  2. 10 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldTest::testDatetimeFields()

Tests migrating D7 datetime fields.

File

core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php, line 199

Class

MigrateFieldTest
Migrates Drupal 7 fields.

Namespace

Drupal\Tests\field\Kernel\Migrate\d7

Code

public function testDatetimeFields() : void {
    $this->installConfig(static::$modules);
    $this->executeMigration('d7_field');
    // Datetime field with 'todate' settings is not migrated.
    $this->assertNull(FieldStorageConfig::load('node.field_event'));
    // Check that we've reported on a conflict in widget_types.
    // Validate that the source count and processed count match up.
    
    /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
    $migration = $this->getMigration('d7_field');
    $messages = iterator_to_array($migration->getIdMap()
        ->getMessages());
    $this->assertCount(5, $messages);
    $msg = "d7_field:type:process_field: Can't migrate field 'field_event' with 'todate' settings. Enable the datetime_range module. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#datetime";
    $this->assertSame($messages[4]->message, $msg);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.