public function redefineUsingExpectation(Expectation $expectation)
    {
        $fqn = $this->function_name->fullyQualifiedName();

        $this->alias(function (...$args) use ($expectation, $fqn) {

            $mock = $expectation->mockeryExpectation()->getMock();
            $target = new ExpectationTarget(ExpectationTarget::TYPE_FUNCTION, $fqn);

            return $mock->{$target->mockMethodName()}(...$args);
        });
    }
public function redefineUsingExpectation(Expectation $expectation)
    {
        $fqn = $this->function_name->fullyQualifiedName();

        $this->alias(function (...$args) use ($expectation, $fqn) {

            $mock = $expectation->mockeryExpectation()->getMock();
            $target = new ExpectationTarget(ExpectationTarget::TYPE_FUNCTION, $fqn);

            return $mock->{$target->mockMethodName()}(...$args);
        });
    }
public function redefineUsingExpectation ( Expectation $ expectation ) { $ fqn = $ this -> function_name -> fullyQualifiedName ( ) ; $ this -> alias ( function ( ... $ args ) use ( $ expectation , $ fqn ) { $ mock = $ expectation -> mockeryExpectation ( ) -> getMock ( ) ; $ target = new ExpectationTarget ( ExpectationTarget :: TYPE_FUNCTION , $ fqn ) ; return $ mock -> { $ target -> mockMethodName ( ) } ( ... $ args ) ; } ) ; }
Redefine target function replacing it with a function that execute Brain Monkey expectation
target method on the mock associated with given Brain Monkey expectation.

@param \Brain\Monkey\Expectation\Expectation $expectation
@return void
Redefine target function replacing it with a function that execute Brain Monkey expectation target method on the mock associated with given Brain Monkey expectation .