Completed
Push — develop ( ffe009...9d0b73 )
by Mike
09:33
created

Console/Command/Project/ParseCommandTest.php (1 issue)

Upgrade to new PHP Analysis Engine

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 \Mockery as m;
16
use League\Pipeline\PipelineInterface;
17
use Mockery\Adapter\Phpunit\MockeryTestCase;
18
use phpDocumentor\Descriptor\ProjectDescriptor;
19
use phpDocumentor\Descriptor\ProjectDescriptorBuilder;
20
use phpDocumentor\Parser\Parser;
21
use Symfony\Component\Console\Input\ArrayInput;
22
use Symfony\Component\Console\Tests\Fixtures\DummyOutput;
23
use Zend\Cache\Storage\Adapter\Memory;
24
use Zend\I18n\Translator\Translator;
25
26
/**
27
 * @coversDefaultClass phpDocumentor\Application\Console\Command\Project\ParseCommand
28
 * @covers ::<protected>
29
 */
30
class ParseCommandTest extends MockeryTestCase
31
{
32
    /**
33
     * Tests the processing of target directory when non is provided.
34
     * @covers ::execute
35
     */
36
    public function testDefaultTargetDirCreation()
37
    {
38
        $this->markTestIncomplete('Needs to be updated, to new command');
39
        $input = new ArrayInput([]);
40
        $output = new DummyOutput();
41
42
        $cache = m::mock(Memory::class);
43
        $cache->shouldReceive('getOptions->setCacheDir')->with(m::type('string'));
44
        $cache->shouldReceive('getOptions->getCacheDir')->andReturn(sys_get_temp_dir());
45
        $cache->shouldReceive('getOptions->getReadable')->andReturn(true);
46
        $cache->shouldReceive('getOptions->getWritable')->andReturn(true);
47
        $cache->shouldReceive('getOptions->getKeyPattern')->andReturn('/.+/');
48
        $cache->shouldReceive('getOptions->getNamespace')->andReturn('PhpDoc\\Cache');
49
        $cache->shouldDeferMissing();
0 ignored issues
show
Deprecated Code introduced by
The method Mockery\MockInterface::shouldDeferMissing() has been deprecated with message: 2.0.0 Please use makePartial() instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
50
51
        $translator = m::mock(Translator::class);
52
        $translator->shouldReceive('translate')
53
            ->zeroOrMoreTimes();
54
55
        $parser = m::mock(Parser::class);
56
        $parser->shouldReceive(
57
            'setForced',
58
            'setEncoding',
59
            'setMarkers',
60
            'setIgnoredTags',
61
            'setValidate',
62
            'setDefaultPackageName',
63
            'setPath',
64
            'parse'
65
        );
66
67
        $projectDescriptorBuilder = m::mock(ProjectDescriptorBuilder::class);
68
        $projectDescriptorBuilder->shouldReceive('createProjectDescriptor', 'getProjectDescriptor')
69
            ->andReturn(new ProjectDescriptor('test'));
70
71
        $command = new ParseCommand(
72
            m::mock(PipelineInterface::class),
73
            m::mock(\phpDocumentor\Translator\Translator::class)
74
        );
75
76
        $command->run($input, $output);
77
    }
78
}
79