function PluginFormFactoryTest::testCreateInstanceInvalidException
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstanceInvalidException()
- 10 core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstanceInvalidException()
- 11.x core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstanceInvalidException()
@covers ::createInstance
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ PluginFormFactoryTest.php, line 142
Class
- PluginFormFactoryTest
- @coversDefaultClass \Drupal\Core\Plugin\PluginFormFactory @group Plugin
Namespace
Drupal\Tests\Core\PluginCode
public function testCreateInstanceInvalidException() {
$this->expectException(InvalidPluginDefinitionException::class);
$this->expectExceptionMessage('The "the_plugin_id" plugin did not specify a valid "invalid" form class, must implement \\Drupal\\Core\\Plugin\\PluginFormInterface');
$expected = new \stdClass();
$this->classResolver
->getInstanceFromDefinition(get_class($expected))
->willReturn($expected);
$plugin = $this->prophesize(PluginWithFormsInterface::class);
$plugin->getPluginId()
->willReturn('the_plugin_id');
$plugin->hasFormClass('invalid')
->willReturn(TRUE);
$plugin->getFormClass('invalid')
->willReturn(get_class($expected));
$form_object = $this->manager
->createInstance($plugin->reveal(), 'invalid');
$this->assertSame(NULL, $form_object);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.