function PluginFormFactoryTest::testCreateInstance
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstance()
- 10 core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstance()
- 11.x core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstance()
@covers ::createInstance
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ PluginFormFactoryTest.php, line 47
Class
- PluginFormFactoryTest
- @coversDefaultClass \Drupal\Core\Plugin\PluginFormFactory @group Plugin
Namespace
Drupal\Tests\Core\PluginCode
public function testCreateInstance() {
$plugin_form = $this->prophesize(PluginFormInterface::class);
$expected = $plugin_form->reveal();
$this->classResolver
->getInstanceFromDefinition(get_class($expected))
->willReturn($expected);
$plugin = $this->prophesize(PluginWithFormsInterface::class);
$plugin->hasFormClass('standard_class')
->willReturn(TRUE);
$plugin->getFormClass('standard_class')
->willReturn(get_class($expected));
$form_object = $this->manager
->createInstance($plugin->reveal(), 'standard_class');
$this->assertSame($expected, $form_object);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.