function EntityRevisionParamConverterTest::testConvertWithInvalidType

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

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

@covers ::convert

File

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

Class

EntityRevisionParamConverterTest
@coversDefaultClass \Drupal\Core\ParamConverter\EntityRevisionParamConverter[[api-linebreak]] @group entity

Namespace

Drupal\Tests\Core\ParamConverter

Code

public function testConvertWithInvalidType() {
  $this->expectException(ParamNotConvertedException::class);
  $this->expectExceptionMessage('The type definition "entity_revision_{entity_type_id}" is invalid. The expected format is "entity_revision:<entity_type_id>".');
  $this->converter
    ->convert('valid_id', [
    'type' => 'entity_revision_{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.