You are here

public function TestBaseTest::invokeProtectedMethod in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/tests/src/Unit/TestBaseTest.php \Drupal\Tests\simpletest\Unit\TestBaseTest::invokeProtectedMethod()

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 core/modules/simpletest/tests/src/Unit/TestBaseTest.php
@covers ::assertEqual @dataProvider providerEqualityAssertions
TestBaseTest::testAssertFalse in core/modules/simpletest/tests/src/Unit/TestBaseTest.php
@covers ::assertFalse @dataProvider providerAssertTrue
TestBaseTest::testAssertIdentical in core/modules/simpletest/tests/src/Unit/TestBaseTest.php
@covers ::assertIdentical @dataProvider providerEqualityAssertions
TestBaseTest::testAssertIdenticalObject in core/modules/simpletest/tests/src/Unit/TestBaseTest.php
@covers ::assertIdenticalObject @dataProvider providerAssertIdenticalObject
TestBaseTest::testAssertNotEqual in core/modules/simpletest/tests/src/Unit/TestBaseTest.php
@covers ::assertNotEqual @dataProvider providerEqualityAssertions

... See full list

File

core/modules/simpletest/tests/src/Unit/TestBaseTest.php, line 55
Contains \Drupal\Tests\simpletest\Unit\TestBaseTest.

Class

TestBaseTest
@coversDefaultClass \Drupal\simpletest\TestBase @group simpletest

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);
}