1 | <?php |
||
26 | class MethodAssemblerTest extends \Mockery\Adapter\Phpunit\MockeryTestCase |
||
27 | { |
||
28 | /** @var MethodAssembler $fixture */ |
||
29 | protected $fixture; |
||
30 | |||
31 | /** @var ArgumentAssembler|m\MockInterface */ |
||
32 | protected $argumentAssemblerMock; |
||
33 | |||
34 | /** @var ProjectDescriptorBuilder|m\MockInterface */ |
||
35 | protected $builderMock; |
||
36 | |||
37 | /** |
||
38 | * Creates a new fixture to test with. |
||
39 | */ |
||
40 | protected function setUp() |
||
52 | |||
53 | /** |
||
54 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::__construct |
||
55 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::create |
||
56 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::mapReflectorToDescriptor |
||
57 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArguments |
||
58 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArgument |
||
59 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addVariadicArgument |
||
60 | */ |
||
61 | public function testCreateMethodDescriptorFromReflector() |
||
97 | |||
98 | /** |
||
99 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::__construct |
||
100 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::create |
||
101 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::mapReflectorToDescriptor |
||
102 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArguments |
||
103 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArgument |
||
104 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addVariadicArgument |
||
105 | */ |
||
106 | public function testCreateMethodDescriptorFromReflectorWhenDocblockIsAbsent() |
||
132 | |||
133 | /** |
||
134 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::__construct |
||
135 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::create |
||
136 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::mapReflectorToDescriptor |
||
137 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArguments |
||
138 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArgument |
||
139 | * @covers \phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addVariadicArgument |
||
140 | */ |
||
141 | public function testCreateMethodDescriptorFromReflectorWhenParamTagsAreAbsent() |
||
169 | |||
170 | /** |
||
171 | * Creates a sample method reflector for the tests with the given data. |
||
172 | * |
||
173 | * @param string $namespace |
||
174 | * @param string $methodName |
||
175 | * @param Argument $argumentMock |
||
176 | * @param DocBlock|m\MockInterface $docBlockMock |
||
177 | * @return Method |
||
178 | */ |
||
179 | protected function givenAMethodReflector($namespace, $methodName, Argument $argumentMock, $docBlockMock = null) |
||
191 | |||
192 | /** |
||
193 | * Generates a DocBlock object with applicable defaults for these tests. |
||
194 | * |
||
195 | * @return DocBlock|m\MockInterface |
||
196 | */ |
||
197 | protected function givenADocBlockObject($withTags) |
||
214 | |||
215 | /** |
||
216 | * Prepares a mock Argument with the given name. |
||
217 | * |
||
218 | * @param string $argumentName |
||
219 | * |
||
220 | * @return Argument |
||
221 | */ |
||
222 | protected function givenAnArgumentWithName($argumentName) |
||
226 | } |
||
227 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: