These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * This file is part of phpDocumentor. |
||
4 | * |
||
5 | * For the full copyright and license information, please view the LICENSE |
||
6 | * file that was distributed with this source code. |
||
7 | * |
||
8 | * @copyright 2010-2018 Mike van Riel<[email protected]> |
||
9 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||
10 | * @link http://phpdoc.org |
||
11 | */ |
||
12 | |||
13 | namespace phpDocumentor\Application\Console\Command\Project; |
||
14 | |||
15 | use League\Pipeline\PipelineInterface; |
||
16 | use Mockery as m; |
||
17 | use Mockery\Adapter\Phpunit\MockeryTestCase; |
||
18 | use Symfony\Component\Console\Input\StringInput; |
||
19 | use Symfony\Component\Console\Tests\Fixtures\DummyOutput; |
||
20 | |||
21 | /** |
||
22 | * @coversDefaultClass phpDocumentor\Application\Console\Command\Project\ParseCommand |
||
23 | * @covers ::<protected> |
||
24 | */ |
||
25 | class ParseCommandTest extends MockeryTestCase |
||
26 | { |
||
27 | /** |
||
28 | * Tests the processing of target directory when non is provided. |
||
29 | * @covers ::execute |
||
30 | */ |
||
31 | public function testPipelineIsInvokedWithTheNecessaryOptions() |
||
32 | { |
||
33 | $input = new StringInput('--force -f abc'); |
||
34 | $output = new DummyOutput(); |
||
35 | |||
36 | $pipeline = m::mock(PipelineInterface::class); |
||
37 | $pipeline |
||
0 ignored issues
–
show
|
|||
38 | ->shouldReceive('__invoke') |
||
39 | ->withArgs(function (array $options) { |
||
40 | return $options['force'] === true && $options['filename'] === ['abc']; |
||
41 | }) |
||
42 | ->once(); |
||
43 | |||
44 | $command = new ParseCommand($pipeline); |
||
45 | |||
46 | $this->assertSame(0, $command->run($input, $output)); |
||
47 | } |
||
48 | } |
||
49 |
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: