comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace spec\Prophecy\Doubler\ClassPatch;
4
5 use PhpSpec\ObjectBehavior;
6 use Prophecy\Argument;
7 use Prophecy\Doubler\Generator\Node\ClassNode;
8 use Prophecy\Doubler\Generator\Node\MethodNode;
9
10 class KeywordPatchSpec extends ObjectBehavior
11 {
12 function it_is_a_patch()
13 {
14 $this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface');
15 }
16
17 function its_priority_is_49()
18 {
19 $this->getPriority()->shouldReturn(49);
20 }
21
22 function it_will_remove_echo_and_eval_methods(
23 ClassNode $node,
24 MethodNode $method1,
25 MethodNode $method2,
26 MethodNode $method3
27 ) {
28 $node->removeMethod('eval')->shouldBeCalled();
29 $node->removeMethod('echo')->shouldBeCalled();
30
31 $method1->getName()->willReturn('echo');
32 $method2->getName()->willReturn('eval');
33 $method3->getName()->willReturn('notKeyword');
34
35 $node->getMethods()->willReturn(array(
36 'echo' => $method1,
37 'eval' => $method2,
38 'notKeyword' => $method3,
39 ));
40
41 $this->apply($node);
42 }
43 }