Click here for the Turkish version of the snippet.
PHPUnit - Private Method Test Eden Fonksiyon
Private bir methodu test etmek için aşağıdaki gibi bir ReflectionClass ve ReflectionMethod kullanan fonksiyon yazabiliriz.
public function testPrivateMethod($class, $method, $args)
{
$reflectionClass = new ReflectionClass($class);
$method = $reflectionClass->getMethod($method);
$method->setAccessible(true);
return $method->invokeArgs($class, $args);
}
İLGİLİ MAKALELER
İLGİLİ KOD PARÇALARI