function EntityRevisionParamConverterTest::testConvertWithInvalidEntityType

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityRevisionParamConverterTest::testConvertWithInvalidEntityType()
  2. 9 core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityRevisionParamConverterTest::testConvertWithInvalidEntityType()
  3. 8.9.x core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityRevisionParamConverterTest::testConvertWithInvalidEntityType()

Tests the convert() method with an invalid entity type ID.

File

core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php, line 126

Class

EntityRevisionParamConverterTest
Tests Drupal\Core\ParamConverter\EntityRevisionParamConverter.

Namespace

Drupal\Tests\Core\ParamConverter

Code

public function testConvertWithInvalidEntityType() : void {
  $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
  $entity_type_manager->getStorage('invalid_entity_type_id')
    ->willThrow(new InvalidPluginDefinitionException('invalid_entity_type_id'));
  $entity_repository = $this->prophesize(EntityRepositoryInterface::class);
  $converter = new EntityRevisionParamConverter($entity_type_manager->reveal(), $entity_repository->reveal());
  $this->expectException(InvalidPluginDefinitionException::class);
  $converter->convert('valid_id', [
    'type' => 'entity_revision:invalid_entity_type_id',
  ], 'foo', [
    'foo' => 'valid_id',
  ]);
}

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