Created
August 20, 2019 00:22
-
-
Save ismaail/ee88984d9caed3baf25d14e7c387a16f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TestCase extends \PHPUnit\Framework\TestCase | |
{ | |
public function testExample() | |
{ | |
$refClass = new \ReflectionClass(\App\MyClass::class); | |
$refMethod = $refClass->getMethod('somePrivateMethod'); | |
$refMethod->setAccessible(true); // make private method accessible | |
$this->assertEqual( | |
'expected value', | |
$refMethod->invoke(new \App\MyClass, 'parameter for somePrivateMethod()') | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment