function EntityTypeManagerTest::testGetFormObjectInvalidOperation
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetFormObjectInvalidOperation()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetFormObjectInvalidOperation()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetFormObjectInvalidOperation()
Tests the getFormObject() method with an invalid operation.
@covers ::getFormObject
@dataProvider provideFormObjectInvalidOperationData
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityTypeManagerTest.php, line 281
Class
- EntityTypeManagerTest
- @coversDefaultClass \Drupal\Core\Entity\EntityTypeManager @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetFormObjectInvalidOperation(string $entity_type_id, string $operation, string $form_class, string $exception_message) : void {
$entity = $this->prophesize(EntityTypeInterface::class);
$entity->getFormClass($operation)
->willReturn(NULL);
if (!$form_class) {
$entity->getHandlerClasses()
->willReturn([]);
}
else {
$entity->getHandlerClasses()
->willReturn([
'form' => [
$operation => $form_class,
],
]);
}
$this->setUpEntityTypeDefinitions([
$entity_type_id => $entity,
]);
$this->expectException(InvalidPluginDefinitionException::class);
$this->expectExceptionMessage($exception_message);
$this->entityTypeManager
->getFormObject($entity_type_id, $operation);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.