You are here

public function EntityConverterTest::testConvertWithInvalidEntityType in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::testConvertWithInvalidEntityType()

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

@expectedException \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

File

core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php, line 120
Contains \Drupal\Tests\Core\ParamConverter\EntityConverterTest.

Class

EntityConverterTest
@coversDefaultClass \Drupal\Core\ParamConverter\EntityConverter @group ParamConverter @group Entity

Namespace

Drupal\Tests\Core\ParamConverter

Code

public function testConvertWithInvalidEntityType() {
  $this->entityManager
    ->expects($this
    ->once())
    ->method('getStorage')
    ->with('invalid_id')
    ->willThrowException(new \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException('invalid_id'));
  $this->entityConverter
    ->convert('id', [
    'type' => 'entity:invalid_id',
  ], 'foo', [
    'foo' => 'id',
  ]);
}