TestingAccessWrapper can't be used with methods that pass arguments by reference. Attempting to do it causes a warning like "PHPUnit\Framework\Error\Warning: Parameter 1 to ... expected to be a reference, value given", and passes the parameter by value:
class A { private static function func( &$ref ) { $ref = 42; } } $a = Wikimedia\TestingAccessWrapper::newFromClass( A::class ); $b = 0; $a->func( $b ); echo $b;
Expected output: 42
Actual output:
Warning: Parameter 1 to A::func() expected to be a reference, value given in ...TestingAccessWrapper.php on line 72 0