Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Last active December 6, 2015 18:58
Show Gist options
  • Save aaronpk/93686628577b8860cfe8 to your computer and use it in GitHub Desktop.
Save aaronpk/93686628577b8860cfe8 to your computer and use it in GitHub Desktop.
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