You are here

public function TestBaseTest::invokeProtectedMethod in SimpleTest 8.3

Invoke methods that are protected or private.

Parameters

object $object: Object on which to invoke the method.

string $method_name: Name of the method to invoke.

array $arguments: Array of arguments to be passed to the method.

Return value

mixed Value returned by the invoked method.

14 calls to TestBaseTest::invokeProtectedMethod()
TestBaseTest::testAssertEqual in tests/src/Unit/TestBaseTest.php
@covers ::assertEqual @dataProvider providerEqualityAssertions
TestBaseTest::testAssertFalse in tests/src/Unit/TestBaseTest.php
@covers ::assertFalse @dataProvider providerAssertTrue
TestBaseTest::testAssertIdentical in tests/src/Unit/TestBaseTest.php
@covers ::assertIdentical @dataProvider providerEqualityAssertions
TestBaseTest::testAssertIdenticalObject in tests/src/Unit/TestBaseTest.php
@covers ::assertIdenticalObject @dataProvider providerAssertIdenticalObject
TestBaseTest::testAssertNotEqual in tests/src/Unit/TestBaseTest.php
@covers ::assertNotEqual @dataProvider providerEqualityAssertions

... See full list

File

tests/src/Unit/TestBaseTest.php, line 52

Class

TestBaseTest
@requires extension curl @coversDefaultClass \Drupal\simpletest\TestBase @group simpletest @group TestBase

Namespace

Drupal\Tests\simpletest\Unit

Code

public function invokeProtectedMethod($object, $method_name, array $arguments) {
  $ref_method = new \ReflectionMethod($object, $method_name);
  $ref_method
    ->setAccessible(TRUE);
  return $ref_method
    ->invokeArgs($object, $arguments);
}