public function PluginFormFactoryTest::testCreateInstanceDefinitionException in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstanceDefinitionException()
@covers ::createInstance
File
- core/
tests/ Drupal/ Tests/ Core/ Plugin/ PluginFormFactoryTest.php, line 127
Class
- PluginFormFactoryTest
- @coversDefaultClass \Drupal\Core\Plugin\PluginFormFactory @group Plugin
Namespace
Drupal\Tests\Core\PluginCode
public function testCreateInstanceDefinitionException() {
$this
->expectException(InvalidPluginDefinitionException::class);
$this
->expectExceptionMessage('The "the_plugin_id" plugin did not specify a "anything" form class');
$plugin = $this
->prophesize(PluginWithFormsInterface::class);
$plugin
->getPluginId()
->willReturn('the_plugin_id');
$plugin
->hasFormClass('anything')
->willReturn(FALSE);
$form_object = $this->manager
->createInstance($plugin
->reveal(), 'anything');
$this
->assertSame(NULL, $form_object);
}