You are here

protected function InvokeMethodTrait::invokeMethod in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 tests/src/Traits/InvokeMethodTrait.php \Drupal\Tests\search_api_solr\Traits\InvokeMethodTrait::invokeMethod()
  2. 8.2 tests/src/Traits/InvokeMethodTrait.php \Drupal\Tests\search_api_solr\Traits\InvokeMethodTrait::invokeMethod()
  3. 4.x tests/src/Traits/InvokeMethodTrait.php \Drupal\Tests\search_api_solr\Traits\InvokeMethodTrait::invokeMethod()

Calls protected/private method of a class.

Parameters

object &$object: Instantiated object that we will run method on.

string: Method name to call.

array $parameters: Array of parameters to pass into method.

Return value

mixed Method return.

6 calls to InvokeMethodTrait::invokeMethod()
SearchApiBackendUnitTest::testIndexField in tests/src/Unit/SearchApiBackendUnitTest.php
@covers ::addIndexField
SearchApiSolrTest::getFieldsAndMapping in tests/src/Kernel/SearchApiSolrTest.php
Gets the Drupal Fields and their Solr mapping.
SearchApiSolrTest::regressionTest2850160 in tests/src/Kernel/SearchApiSolrTest.php
Regression tests for #2850160.
SearchApiSolrTest::testQueryConditions in tests/src/Kernel/SearchApiSolrTest.php
Tests the conversion of Search API queries into Solr queries.
SearchApiSolrTest::testQueryConditionsAndLanguageFilter in tests/src/Kernel/SearchApiSolrTest.php
Tests the conversion of language aware queries into Solr queries.

... See full list

File

tests/src/Traits/InvokeMethodTrait.php, line 24

Class

InvokeMethodTrait
Provides a function to invoke protected/private methods of a class.

Namespace

Drupal\Tests\search_api_solr\Traits

Code

protected function invokeMethod(&$object, $methodName, array $parameters = []) {
  $reflection = new \ReflectionClass(get_class($object));
  $method = $reflection
    ->getMethod($methodName);
  $method
    ->setAccessible(TRUE);
  return $method
    ->invokeArgs($object, $parameters);
}