Mercurial > hg > isophonics-drupal-site
annotate vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/KeywordPatchSpec.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
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\ClassNode; |
Chris@0 | 8 use Prophecy\Doubler\Generator\Node\MethodNode; |
Chris@0 | 9 |
Chris@0 | 10 class KeywordPatchSpec extends ObjectBehavior |
Chris@0 | 11 { |
Chris@0 | 12 function it_is_a_patch() |
Chris@0 | 13 { |
Chris@0 | 14 $this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface'); |
Chris@0 | 15 } |
Chris@0 | 16 |
Chris@0 | 17 function its_priority_is_49() |
Chris@0 | 18 { |
Chris@0 | 19 $this->getPriority()->shouldReturn(49); |
Chris@0 | 20 } |
Chris@0 | 21 |
Chris@0 | 22 function it_will_remove_echo_and_eval_methods( |
Chris@0 | 23 ClassNode $node, |
Chris@0 | 24 MethodNode $method1, |
Chris@0 | 25 MethodNode $method2, |
Chris@0 | 26 MethodNode $method3 |
Chris@0 | 27 ) { |
Chris@0 | 28 $node->removeMethod('eval')->shouldBeCalled(); |
Chris@0 | 29 $node->removeMethod('echo')->shouldBeCalled(); |
Chris@0 | 30 |
Chris@0 | 31 $method1->getName()->willReturn('echo'); |
Chris@0 | 32 $method2->getName()->willReturn('eval'); |
Chris@0 | 33 $method3->getName()->willReturn('notKeyword'); |
Chris@0 | 34 |
Chris@0 | 35 $node->getMethods()->willReturn(array( |
Chris@0 | 36 'echo' => $method1, |
Chris@0 | 37 'eval' => $method2, |
Chris@0 | 38 'notKeyword' => $method3, |
Chris@0 | 39 )); |
Chris@0 | 40 |
Chris@0 | 41 $this->apply($node); |
Chris@0 | 42 } |
Chris@0 | 43 } |