function ContentEntityTest::testConstructorInvalidBundle

Tests the constructor for invalid entity bundle.

File

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

Class

ContentEntityTest
Tests the entity content source plugin.

Namespace

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

Code

public function testConstructorInvalidBundle() {
  $migration = $this->prophesize(MigrationInterface::class)
    ->reveal();
  $configuration = [
    'bundle' => 'foo',
  ];
  $plugin_definition = [
    'entity_type' => 'node',
  ];
  $this->expectException(\InvalidArgumentException::class);
  $this->expectExceptionMessage('The provided bundle (foo) is not valid for the (node) entity type.');
  ContentEntity::create($this->container, $configuration, 'content_entity:node', $plugin_definition, $migration);
}

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