$ref_decorated->setValue($mock_decorator, $mock_decorated);
if ($exception_on_invalid) {
- $this->setExpectedException('Drupal\Component\Plugin\Exception\PluginNotFoundException');
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('Drupal\Component\Plugin\Exception\PluginNotFoundException');
+ }
+ else {
+ $this->setExpectedException('Drupal\Component\Plugin\Exception\PluginNotFoundException');
+ }
}
// Exercise getDefinition(). It calls parent::getDefinition().