function PluginExistsConstraintTest::testOption

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Core/Plugin/PluginExistsConstraintTest.php \Drupal\Tests\Core\Plugin\PluginExistsConstraintTest::testOption()

Tests with different option keys.

@testWith ["value"] ["manager"]

@covers ::create @covers ::__construct

File

core/tests/Drupal/Tests/Core/Plugin/PluginExistsConstraintTest.php, line 42

Class

PluginExistsConstraintTest
@group Plugin @group Validation

Namespace

Drupal\Tests\Core\Plugin

Code

public function testOption(string $option_key) : void {
    $container = $this->createMock(ContainerInterface::class);
    $manager = $this->createMock(PluginManagerInterface::class);
    $container->expects($this->any())
        ->method('get')
        ->with('plugin.manager.mock')
        ->willReturn($manager);
    $constraint = PluginExistsConstraint::create($container, [
        $option_key => 'plugin.manager.mock',
    ], 'test_plugin_id', []);
    $this->assertSame($manager, $constraint->pluginManager);
}

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