function EntityTypeManagerTest::testGetFormObjectInvalidOperation

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

Tests the getFormObject() method with an invalid operation.

@covers ::getFormObject

File

core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php, line 257

Class

EntityTypeManagerTest
@coversDefaultClass \Drupal\Core\Entity\EntityTypeManager[[api-linebreak]] @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testGetFormObjectInvalidOperation() {
  $entity = $this->prophesize(EntityTypeInterface::class);
  $entity->getFormClass('edit')
    ->willReturn('');
  $this->setUpEntityTypeDefinitions([
    'test_entity_type' => $entity,
  ]);
  $this->expectException(InvalidPluginDefinitionException::class);
  $this->entityTypeManager
    ->getFormObject('test_entity_type', 'edit');
}

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