function EntityConverterTest::testConvertWithInvalidDynamicEntityType

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

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

File

core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php, line 230

Class

EntityConverterTest
@coversDefaultClass \Drupal\Core\ParamConverter\EntityConverter[[api-linebreak]] @group ParamConverter @group Entity

Namespace

Drupal\Tests\Core\ParamConverter

Code

public function testConvertWithInvalidDynamicEntityType() : void {
  $this->expectException(ParamNotConvertedException::class);
  $this->expectExceptionMessage('The "foo" parameter was not converted because the "invalid_id" parameter is missing.');
  $this->entityConverter
    ->convert('id', [
    'type' => 'entity:{invalid_id}',
  ], 'foo', [
    'foo' => 'id',
  ]);
}

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