function ContentEntityConstructorTest::providerTestConstructor

Same name in other branches
  1. 10 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityConstructorTest::providerTestConstructor()
  2. 11.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityConstructorTest::providerTestConstructor()

Provides data for constructor tests.

File

core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php, line 43

Class

ContentEntityConstructorTest
Tests the constructor of the entity content source plugin.

Namespace

Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source

Code

public function providerTestConstructor() {
    return [
        'entity type missing' => [
            [],
            [
                'entity_type' => '',
            ],
            InvalidPluginDefinitionException::class,
            'Missing required "entity_type" definition.',
        ],
        'non content entity' => [
            [],
            [
                'entity_type' => 'node_type',
            ],
            InvalidPluginDefinitionException::class,
            'The entity type (node_type) is not supported. The "content_entity" source plugin only supports content entities.',
        ],
        'not bundleable' => [
            [
                'bundle' => 'foo',
            ],
            [
                'entity_type' => 'user',
            ],
            \InvalidArgumentException::class,
            'A bundle was provided but the entity type (user) is not bundleable.',
        ],
        'invalid bundle' => [
            [
                'bundle' => 'foo',
            ],
            [
                'entity_type' => 'node',
            ],
            \InvalidArgumentException::class,
            'The provided bundle (foo) is not valid for the (node) entity type.',
        ],
    ];
}

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