class ContentEntityConstructorTest
Same name in this branch
- main core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityConstructorTest
Same name and namespace in other branches
- 10 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityConstructorTest
- 11.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityConstructorTest
- 11.x core/modules/migrate/tests/src/Kernel/Plugin/source/ContentEntityConstructorTest.php \Drupal\Tests\migrate\Kernel\Plugin\source\ContentEntityConstructorTest
- 9 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityConstructorTest
Tests the constructor of the entity content source plugin.
Attributes
#[Group('migrate')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Kernel\Plugin\source\ContentEntityConstructorTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of ContentEntityConstructorTest
File
-
core/
modules/ migrate/ tests/ src/ Kernel/ Plugin/ source/ ContentEntityConstructorTest.php, line 18
Namespace
Drupal\Tests\migrate\Kernel\Plugin\sourceView source
class ContentEntityConstructorTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'user',
];
/**
* Tests the constructor.
*/
public function testConstructor(array $configuration, array $plugin_definition, string $exception_class, string $expected) : void {
$migration = $this->prophesize(MigrationInterface::class)
->reveal();
$this->expectException($exception_class);
$this->expectExceptionMessage($expected);
ContentEntity::create($this->container, $configuration, 'content_entity', $plugin_definition, $migration);
}
/**
* Provides data for constructor tests.
*/
public static function providerTestConstructor() : array {
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.