You are here

public function ContentEntityTest::testConstructorInvalidBundle in Drupal 8

Same name and namespace in other branches
  1. 9 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 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);
}