$method_ref = new \ReflectionMethod($trait, 'doGetDefinition');
$method_ref->setAccessible(TRUE);
// Call doGetDefinition, with $exception_on_invalid always TRUE.
- $this->setExpectedException(PluginNotFoundException::class);
+ if (method_exists($this, 'expectException')) {
+ $this->expectException(PluginNotFoundException::class);
+ }
+ else {
+ $this->setExpectedException(PluginNotFoundException::class);
+ }
$method_ref->invoke($trait, $definitions, $plugin_id, TRUE);
}
->method('getDefinitions')
->willReturn($definitions);
// Call getDefinition(), with $exception_on_invalid always TRUE.
- $this->setExpectedException(PluginNotFoundException::class);
+ if (method_exists($this, 'expectException')) {
+ $this->expectException(PluginNotFoundException::class);
+ }
+ else {
+ $this->setExpectedException(PluginNotFoundException::class);
+ }
$trait->getDefinition($plugin_id, TRUE);
}