function PluginFormFactoryTest::testCreateInstanceUsingPluginWithSlashes

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstanceUsingPluginWithSlashes()
  2. 10 core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstanceUsingPluginWithSlashes()
  3. 11.x core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php \Drupal\Tests\Core\Plugin\PluginFormFactoryTest::testCreateInstanceUsingPluginWithSlashes()

@covers ::createInstance

File

core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php, line 78

Class

PluginFormFactoryTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Plugin%21PluginFormFactory.php/class/PluginFormFactory/9" title="Provides form discovery capabilities for plugins." class="local">\Drupal\Core\Plugin\PluginFormFactory</a> @group Plugin

Namespace

Drupal\Tests\Core\Plugin

Code

public function testCreateInstanceUsingPluginWithSlashes() {
    $this->classResolver
        ->getInstanceFromDefinition(Argument::cetera())
        ->shouldNotBeCalled();
    $plugin = $this->prophesize(PluginWithFormsInterface::class)
        ->willImplement(PluginFormInterface::class);
    $plugin->hasFormClass('configure')
        ->willReturn(TRUE);
    $plugin->getFormClass('configure')
        ->willReturn('\\' . get_class($plugin->reveal()));
    $form_object = $this->manager
        ->createInstance($plugin->reveal(), 'configure');
    $this->assertSame($plugin->reveal(), $form_object);
}

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