Completed
Push — master ( 7888fa...8e3a44 )
by Ivannis Suárez
04:39
created

FileCacheTests   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 28
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createCache() 0 4 1
A testCreate() 0 14 1
1
<?php
2
3
/**
4
 * This file is part of the Cubiche/Metadata component.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Core\Metadata\Tests\Units\Cache;
13
14
use Cubiche\Core\Metadata\Cache\FileCache;
15
16
/**
17
 * FileCacheTests class.
18
 *
19
 * Generated by TestGenerator on 2017-05-16 at 13:17:21.
20
 */
21
class FileCacheTests extends CacheTestCase
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function createCache()
27
    {
28
        return new FileCache($this->cacheDirectory);
29
    }
30
31
    /**
32
     * Test create.
33
     */
34
    public function testCreate()
35
    {
36
        $this
37
            ->given($invalidCacheDir = __DIR__.'/Invalid')
38
            ->given($nonWritableCacheDir = '/root')
39
            ->then()
40
                ->exception(function () use ($invalidCacheDir) {
41
                    new FileCache($invalidCacheDir);
42
                })->isInstanceOf(\InvalidArgumentException::class)
43
                ->exception(function () use ($nonWritableCacheDir) {
44
                    new FileCache($nonWritableCacheDir);
45
                })->isInstanceOf(\InvalidArgumentException::class)
46
        ;
47
    }
48
}
49