function DiscoveryTraitTest::testGetDefinitionException
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php \Drupal\Tests\Component\Plugin\Discovery\DiscoveryTraitTest::testGetDefinitionException()
- 8.9.x core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php \Drupal\Tests\Component\Plugin\Discovery\DiscoveryTraitTest::testGetDefinitionException()
- 11.x core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php \Drupal\Tests\Component\Plugin\Discovery\DiscoveryTraitTest::testGetDefinitionException()
@covers ::getDefinition @dataProvider providerDoGetDefinitionException @uses \Drupal\Component\Plugin\Exception\PluginNotFoundException
File
-
core/
tests/ Drupal/ Tests/ Component/ Plugin/ Discovery/ DiscoveryTraitTest.php, line 101
Class
- DiscoveryTraitTest
- @group Plugin @coversDefaultClass \Drupal\Component\Plugin\Discovery\DiscoveryTrait
Namespace
Drupal\Tests\Component\Plugin\DiscoveryCode
public function testGetDefinitionException($expected, $definitions, $plugin_id) : void {
// Since getDefinition is a wrapper around doGetDefinition(), we can re-use
// its data provider. We just have to tell abstract method getDefinitions()
// to use the $definitions array.
$trait = $this->getMockBuilder(DiscoveryTraitMockableClass::class)
->onlyMethods([
'getDefinitions',
])
->getMock();
$trait->expects($this->once())
->method('getDefinitions')
->willReturn($definitions);
// Call getDefinition(), with $exception_on_invalid always TRUE.
$this->expectException(PluginNotFoundException::class);
$trait->getDefinition($plugin_id, TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.