function PluginExistsConstraintTest::testManagerOption
Tests plugin is created when manager option is set to a valid service ID.
@legacy-covers ::create @legacy-covers ::__construct
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ PluginExistsConstraintTest.php, line 41
Class
- PluginExistsConstraintTest
- Tests Drupal\Core\Plugin\Plugin\Validation\Constraint\PluginExistsConstraint.
Namespace
Drupal\Tests\Core\PluginCode
public function testManagerOption() : 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, [
'manager' => '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.