28 lines
671 B
PHP
28 lines
671 B
PHP
<?php
|
|
|
|
namespace Tests;
|
|
|
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
|
|
|
abstract class TestCase extends BaseTestCase
|
|
{
|
|
use CreatesApplication;
|
|
|
|
/**
|
|
* Call protected/private method of a class.
|
|
*
|
|
* @param object &$object
|
|
* @param string $methodName
|
|
* @param array $parameters
|
|
* @return mixed
|
|
*/
|
|
public function invokePrivateMethod(&$object, $methodName, array $parameters = [])
|
|
{
|
|
$reflection = new \ReflectionClass(get_class($object));
|
|
$method = $reflection->getMethod($methodName);
|
|
$method->setAccessible(true);
|
|
|
|
return $method->invokeArgs($object, $parameters);
|
|
}
|
|
}
|