mageekguy\atoum\report\fields\runner\coverage\html::setReflectionClassInjector PHP Метод

setReflectionClassInjector() публичный Метод

public setReflectionClassInjector ( closure $reflectionClassInjector )
$reflectionClassInjector closure
    public function setReflectionClassInjector(\closure $reflectionClassInjector)
    {
        $closure = new \reflectionMethod($reflectionClassInjector, '__invoke');
        if ($closure->getNumberOfParameters() != 1) {
            throw new exceptions\logic\invalidArgument('Reflection class injector must take one argument');
        }
        $this->reflectionClassInjector = $reflectionClassInjector;
        return $this;
    }

Usage Example

Пример #1
0
 public function testGetReflectionClass()
 {
     $this->if($field = new testedClass(uniqid(), uniqid(), uniqid()))->then->object($field->getReflectionClass(__CLASS__))->isInstanceOf('reflectionClass')->string($field->getReflectionClass(__CLASS__)->getName())->isEqualTo(__CLASS__)->if($field->setReflectionClassInjector(function ($class) {
     }))->then->exception(function () use($field) {
         $field->getReflectionClass(uniqid());
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\runtime\\unexpectedValue')->hasMessage('Reflection class injector must return a \\reflectionClass instance');
 }