public function setTestFactory($testFactory = null)
{
$testFactory = $testFactory ?: function ($testClass) {
return new $testClass();
};
$runner = $this;
$this->testFactory = function ($testClass) use($testFactory, $runner) {
$test = call_user_func($testFactory, $testClass);
if ($runner->usageOfUndefinedMethodInMockAreAllowed() === false) {
$test->getMockGenerator()->disallowUndefinedMethodUsage();
}
return $test;
};
return $this;
}