trait ProcessorTestTrait in Search API 8
Provides common methods for processor testing unit tests.
Hierarchy
- trait \Drupal\Tests\search_api\Unit\Processor\ProcessorTestTrait
File
- tests/
src/ Unit/ Processor/ ProcessorTestTrait.php, line 8
Namespace
Drupal\Tests\search_api\Unit\ProcessorView source
trait ProcessorTestTrait {
/**
* The tested processor.
*
* @var \Drupal\search_api\Processor\ProcessorInterface
*/
protected $processor;
/**
* Invokes a method on the processor.
*
* @param string $method_name
* The method's name.
* @param array $args
* (optional) The arguments to pass in the method call.
*
* @return mixed
* Whatever the invoked method returned.
*/
protected function invokeMethod($method_name, array $args = []) {
$class = new \ReflectionClass(get_class($this->processor));
$method = $class
->getMethod($method_name);
$method
->setAccessible(TRUE);
return $method
->invokeArgs($this->processor, $args);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ProcessorTestTrait:: |
protected | property | The tested processor. | |
ProcessorTestTrait:: |
protected | function | Invokes a method on the processor. |