Mercurial > hg > isophonics-drupal-site
comparison vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/TraversablePatchSpec.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 | |
9 class TraversablePatchSpec extends ObjectBehavior | |
10 { | |
11 function it_is_a_patch() | |
12 { | |
13 $this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface'); | |
14 } | |
15 | |
16 function it_supports_class_that_implements_only_Traversable(ClassNode $node) | |
17 { | |
18 $node->getInterfaces()->willReturn(array('Traversable')); | |
19 | |
20 $this->supports($node)->shouldReturn(true); | |
21 } | |
22 | |
23 function it_does_not_support_class_that_implements_Iterator(ClassNode $node) | |
24 { | |
25 $node->getInterfaces()->willReturn(array('Traversable', 'Iterator')); | |
26 | |
27 $this->supports($node)->shouldReturn(false); | |
28 } | |
29 | |
30 function it_does_not_support_class_that_implements_IteratorAggregate(ClassNode $node) | |
31 { | |
32 $node->getInterfaces()->willReturn(array('Traversable', 'IteratorAggregate')); | |
33 | |
34 $this->supports($node)->shouldReturn(false); | |
35 } | |
36 | |
37 function it_has_100_priority() | |
38 { | |
39 $this->getPriority()->shouldReturn(100); | |
40 } | |
41 | |
42 function it_forces_node_to_implement_IteratorAggregate(ClassNode $node) | |
43 { | |
44 $node->addInterface('Iterator')->shouldBeCalled(); | |
45 | |
46 $node->addMethod(Argument::type('Prophecy\Doubler\Generator\Node\MethodNode'))->willReturn(null); | |
47 | |
48 $this->apply($node); | |
49 } | |
50 } |