function ContentEntityTest::testConstructorNotBundable

Tests the constructor for not bundleable entity.

File

core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php, line 207

Class

ContentEntityTest
Tests the entity content source plugin.

Namespace

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

Code

public function testConstructorNotBundable() {
    $migration = $this->prophesize(MigrationInterface::class)
        ->reveal();
    $configuration = [
        'bundle' => 'foo',
    ];
    $plugin_definition = [
        'entity_type' => 'user',
    ];
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage('A bundle was provided but the entity type (user) is not bundleable');
    ContentEntity::create($this->container, $configuration, 'content_entity:user', $plugin_definition, $migration);
}

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