You are here

function ReflectionClassNewInstancePatchSpec::it_makes_all_newInstance_arguments_optional in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatchSpec.php \spec\Prophecy\Doubler\ClassPatch\ReflectionClassNewInstancePatchSpec::it_makes_all_newInstance_arguments_optional()

Parameters

\Prophecy\Doubler\Generator\Node\ClassNode $class:

\Prophecy\Doubler\Generator\Node\MethodNode $method:

\Prophecy\Doubler\Generator\Node\ArgumentNode $arg1:

\Prophecy\Doubler\Generator\Node\ArgumentNode $arg2:

File

vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatchSpec.php, line 39

Class

ReflectionClassNewInstancePatchSpec

Namespace

spec\Prophecy\Doubler\ClassPatch

Code

function it_makes_all_newInstance_arguments_optional($class, $method, $arg1, $arg2) {
  $class
    ->getMethod('newInstance')
    ->willReturn($method);
  $method
    ->getArguments()
    ->willReturn(array(
    $arg1,
  ));
  $arg1
    ->setDefault(null)
    ->shouldBeCalled();
  $this
    ->apply($class);
}