function MigrateFieldPluginManagerTest::testDefaultWeight

Same name in other branches
  1. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php \Drupal\Tests\migrate_drupal\Kernel\MigrateFieldPluginManagerTest::testDefaultWeight()
  2. 10 core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php \Drupal\Tests\migrate_drupal\Kernel\MigrateFieldPluginManagerTest::testDefaultWeight()
  3. 11.x 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']);
        }
    }
}

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