getControllerClass(); $builder = $this->getMockBuilder($class)->disableOriginalConstructor(); if ($methods) { $builder->setMethods($methods); } if (isset($mockClassName)) { $builder->setMockClassName($mockClassName); } $getMock = trait_exists($class) ? 'getMockForTrait' : 'getMockForAbstractClass'; return $builder->$getMock(); } /** * Set a private or protected property of the given object * * @param object $object * @param string $property * @param mixed $value */ protected function setPrivateProperty($object, $property, $value) { if (!is_object($object)) { throw new \InvalidArgumentException("Excpected an object, got a " . gettype($object)); } $refl = new \ReflectionProperty($object, $property); $refl->setAccessible(true); $refl->setValue($object, $value); } }