Eloquent\Phony\Mock\Handle\AbstractHandle::__construct PHP Method

__construct() public method

Construct a new handle.
public __construct ( ReflectionClass $class, stdClass $state, ReflectionMethod $callParentMethod = null, ReflectionMethod $callTraitMethod = null, ReflectionMethod $callMagicMethod = null, Eloquent\Phony\Mock\Mock $mock = null, StubFactory $stubFactory, StubVerifierFactory $stubVerifierFactory, AssertionRenderer $assertionRenderer, Eloquent\Phony\Assertion\AssertionRecorder $assertionRecorder, Invoker $invoker )
$class ReflectionClass The class.
$state stdClass The state.
$callParentMethod ReflectionMethod The call parent method, or null if no parent class exists.
$callTraitMethod ReflectionMethod The call trait method, or null if no trait methods are implemented.
$callMagicMethod ReflectionMethod The call magic method, or null if magic calls are not supported.
$mock Eloquent\Phony\Mock\Mock The mock, or null if this is a static handle.
$stubFactory Eloquent\Phony\Stub\StubFactory The stub factory to use.
$stubVerifierFactory Eloquent\Phony\Stub\StubVerifierFactory The stub verifier factory to use.
$assertionRenderer Eloquent\Phony\Assertion\AssertionRenderer The assertion renderer to use.
$assertionRecorder Eloquent\Phony\Assertion\AssertionRecorder The assertion recorder to use.
$invoker Eloquent\Phony\Invocation\Invoker The invoker to use.
    public function __construct(ReflectionClass $class, stdClass $state, ReflectionMethod $callParentMethod = null, ReflectionMethod $callTraitMethod = null, ReflectionMethod $callMagicMethod = null, Mock $mock = null, StubFactory $stubFactory, StubVerifierFactory $stubVerifierFactory, AssertionRenderer $assertionRenderer, AssertionRecorder $assertionRecorder, Invoker $invoker)
    {
        $this->mock = $mock;
        $this->class = $class;
        $this->state = $state;
        $this->callParentMethod = $callParentMethod;
        $this->callTraitMethod = $callTraitMethod;
        $this->callMagicMethod = $callMagicMethod;
        $this->stubFactory = $stubFactory;
        $this->stubVerifierFactory = $stubVerifierFactory;
        $this->assertionRenderer = $assertionRenderer;
        $this->assertionRecorder = $assertionRecorder;
        $this->invoker = $invoker;
        $uncallableMethodsProperty = $class->getProperty('_uncallableMethods');
        $uncallableMethodsProperty->setAccessible(true);
        $this->uncallableMethods = $uncallableMethodsProperty->getValue(null);
        $traitMethodsProperty = $class->getProperty('_traitMethods');
        $traitMethodsProperty->setAccessible(true);
        $this->traitMethods = $traitMethodsProperty->getValue(null);
        $customMethodsProperty = $class->getProperty('_customMethods');
        $customMethodsProperty->setAccessible(true);
        $this->customMethods = $customMethodsProperty->getValue(null);
    }

Usage Example

Beispiel #1
0
 /**
  * Construct a new static handle.
  *
  * @param ReflectionClass     $class               The class.
  * @param stdClass            $state               The state.
  * @param StubFactory         $stubFactory         The stub factory to use.
  * @param StubVerifierFactory $stubVerifierFactory The stub verifier factory to use.
  * @param AssertionRenderer   $assertionRenderer   The assertion renderer to use.
  * @param AssertionRecorder   $assertionRecorder   The assertion recorder to use.
  * @param Invoker             $invoker             The invoker to use.
  */
 public function __construct(ReflectionClass $class, stdClass $state, StubFactory $stubFactory, StubVerifierFactory $stubVerifierFactory, AssertionRenderer $assertionRenderer, AssertionRecorder $assertionRecorder, Invoker $invoker)
 {
     if ($class->hasMethod('_callParentStatic')) {
         $callParentMethod = $class->getMethod('_callParentStatic');
         $callParentMethod->setAccessible(true);
     } else {
         $callParentMethod = null;
     }
     if ($class->hasMethod('_callTraitStatic')) {
         $callTraitMethod = $class->getMethod('_callTraitStatic');
         $callTraitMethod->setAccessible(true);
     } else {
         $callTraitMethod = null;
     }
     if ($class->hasMethod('_callMagicStatic')) {
         $callMagicMethod = $class->getMethod('_callMagicStatic');
         $callMagicMethod->setAccessible(true);
     } else {
         $callMagicMethod = null;
     }
     parent::__construct($class, $state, $callParentMethod, $callTraitMethod, $callMagicMethod, null, $stubFactory, $stubVerifierFactory, $assertionRenderer, $assertionRecorder, $invoker);
 }