Mercurial > hg > isophonics-drupal-site
annotate vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatchSpec.php @ 9:1fc0ff908d1f
Add another data file
author | Chris Cannam |
---|---|
date | Mon, 05 Feb 2018 12:34:32 +0000 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace spec\Prophecy\Doubler\ClassPatch; |
Chris@0 | 4 |
Chris@0 | 5 use PhpSpec\ObjectBehavior; |
Chris@0 | 6 use Prophecy\Argument; |
Chris@0 | 7 use Prophecy\Doubler\Generator\Node\ArgumentNode; |
Chris@0 | 8 use Prophecy\Doubler\Generator\Node\ClassNode; |
Chris@0 | 9 use Prophecy\Doubler\Generator\Node\MethodNode; |
Chris@0 | 10 |
Chris@0 | 11 class ReflectionClassNewInstancePatchSpec extends ObjectBehavior |
Chris@0 | 12 { |
Chris@0 | 13 function it_is_a_patch() |
Chris@0 | 14 { |
Chris@0 | 15 $this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface'); |
Chris@0 | 16 } |
Chris@0 | 17 |
Chris@0 | 18 function its_priority_is_50() |
Chris@0 | 19 { |
Chris@0 | 20 $this->getPriority()->shouldReturn(50); |
Chris@0 | 21 } |
Chris@0 | 22 |
Chris@0 | 23 function it_supports_ReflectionClass_only(ClassNode $reflectionClassNode, ClassNode $anotherClassNode) |
Chris@0 | 24 { |
Chris@0 | 25 $reflectionClassNode->getParentClass()->willReturn('ReflectionClass'); |
Chris@0 | 26 $anotherClassNode->getParentClass()->willReturn('stdClass'); |
Chris@0 | 27 |
Chris@0 | 28 $this->supports($reflectionClassNode)->shouldReturn(true); |
Chris@0 | 29 $this->supports($anotherClassNode)->shouldReturn(false); |
Chris@0 | 30 } |
Chris@0 | 31 |
Chris@0 | 32 function it_makes_all_newInstance_arguments_optional( |
Chris@0 | 33 ClassNode $class, |
Chris@0 | 34 MethodNode $method, |
Chris@0 | 35 ArgumentNode $arg1 |
Chris@0 | 36 ) { |
Chris@0 | 37 $class->getMethod('newInstance')->willReturn($method); |
Chris@0 | 38 $method->getArguments()->willReturn(array($arg1)); |
Chris@0 | 39 $arg1->setDefault(null)->shouldBeCalled(); |
Chris@0 | 40 |
Chris@0 | 41 $this->apply($class); |
Chris@0 | 42 } |
Chris@0 | 43 } |