Completed
Push — develop ( 141adb...8f70d4 )
by Jaap
05:39
created

ConfigureCacheTest::cacheDirProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
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\Stage\Cache;
14
15
use \Mockery as m;
16
use Mockery\Adapter\Phpunit\MockeryTestCase;
17
use phpDocumentor\Application\Stage\Payload;
18
use phpDocumentor\Descriptor\ProjectDescriptorBuilder;
19
use phpDocumentor\Path;
20
use Stash\Pool;
21
22
class ConfigureCacheTest extends MockeryTestCase
23
{
24
    /**
25
     * @dataProvider cacheDirProvider
26
     * @throws \Exception
27
     */
28
    public function testInvokeWithCachePath($configuredPath)
29
    {
30
        $configuration = [
31
            'phpdocumentor' => [
32
                'paths' => [
33
                    'cache' => $configuredPath,
34
                ],
35
            ],
36
        ];
37
38
        $cacheStorage = m::mock(Pool::class);
39
        $cacheStorage->shouldReceive('setDriver')
40
            ->with(m::type(\Stash\Driver\FileSystem::class))
41
            ->once();
42
43
        $stage = new ConfigureCache($cacheStorage);
44
45
        $payload = new Payload($configuration, m::mock(ProjectDescriptorBuilder::class));
46
47
        self::assertSame(
48
            $payload,
49
            $stage($payload)
50
        );
51
    }
52
53
    public function cacheDirProvider()
54
    {
55
        return [
56
            [
57
                '/tmp/cache',
58
            ],
59
            [
60
                'cache/relative',
61
            ],
62
            [
63
                new Path('/tmp/cache'),
64
            ],
65
            [
66
                new Path('cache/relative'),
67
            ],
68
        ];
69
    }
70
}
71