You are here

public function ContentEntityTest::testConstructorInvalidBundle in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityTest::testConstructorInvalidBundle()

Tests the constructor for invalid entity bundle.

File

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

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);
}