'definition',
['plugin_name' => 'definition'
], 'plugin_name'
],
[NULL,
['plugin_name' => 'definition'
], 'bad_plugin_name'
],
];
} /**
* @covers ::doGetDefinition
* @dataProvider providerDoGetDefinition
*/
public function testDoGetDefinition($expected,
$definitions,
$plugin_id) { // Mock the trait.
$trait =
$this->
getMockForTrait('Drupal\Component\Plugin\Discovery\DiscoveryTrait'
);
// Un-protect the method using reflection.
$method_ref =
new \
ReflectionMethod($trait, 'doGetDefinition'
);
// Call doGetDefinition, with $exception_on_invalid always FALSE.
$this->
assertSame( $expected,
$method_ref->
invoke($trait,
$definitions,
$plugin_id, FALSE
) );
} /**
* Data provider for testDoGetDefinitionException()
*
* @return array
* - Expected plugin definition.
* - Plugin definition array, to pass to doGetDefinition().
* - Plugin ID to get, passed to doGetDefinition().
*/