You are here

public function MigrateFieldPluginManagerTest::testDefaultWeight in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php \Drupal\Tests\migrate_drupal\Kernel\MigrateFieldPluginManagerTest::testDefaultWeight()

Tests that plugins with no explicit weight are given a weight of 0.

File

core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php, line 110

Class

MigrateFieldPluginManagerTest
Tests the field plugin manager.

Namespace

Drupal\Tests\migrate_drupal\Kernel

Code

public function testDefaultWeight() {
  $definitions = $this->pluginManager
    ->getDefinitions();
  $deprecated_plugins = [
    'date',
  ];
  foreach ($definitions as $id => $definition) {
    $this
      ->assertArrayHasKey('weight', $definition);
    if (in_array($id, $deprecated_plugins, TRUE)) {
      $this
        ->assertSame(9999999, $definition['weight']);
    }
    else {
      $this
        ->assertSame(0, $definition['weight']);
    }
  }
}