Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Last active December 6, 2015 18:58
Make all protected methods public for PHPUnit
<?php
/*
* Make all protected methods public for PHPUnit
*/
class ExampleClassTest extends ExampleClassTest {
public function __call($method, $args) {
$method = new \ReflectionMethod('ExampleClass', $method);
$method->setAccessible(true);
return $method->invokeArgs($this, $args);
}
public static function __callStatic($method, $args) {
$method = new \ReflectionMethod('ExampleClass', $method);
$method->setAccessible(true);
return $method->invokeArgs(null, $args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment