Test Setup Failed
Push — master ( 562b48...254002 )
by Gabriel
04:15 queued 14s
created

ManagerTest::test_saveData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 13
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
namespace Nip\Cache\Tests\Legacy;
4
5
use Nip\Cache\Manager;
6
use Nip\Cache\Tests\AbstractTest;
7
8
/**
9
 * Class ManagerTest
10
 * @package Nip\Cache\Tests
11
 */
12
class ManagerTest extends AbstractTest
13
{
14
    public function test_cachePath()
15
    {
16
        $manager = new Manager();
17
        self::assertSame(CACHE_PATH, $manager->cachePath());
18
    }
19
20
    public function test_filePath()
21
    {
22
        $manager = new Manager();
23
        $manager->cachePath();
24
        self::assertSame(CACHE_PATH . DIRECTORY_SEPARATOR . 'test.php', $manager->filePath('test'));
25
    }
26
27 View Code Duplication
    public function test_put()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
    {
29
        $manager = new Manager();
30
        $data = [1, 2];
31
        $manager->put('test-save', $data);
32
        self::assertFileExists(CACHE_PATH . DIRECTORY_SEPARATOR . 'test-save.php');
33
34
        $manager = new Manager();
35
        $manager->setActive(true);
36
        self::assertSame($data, $manager->get('test-save'));
37
38
        unlink(CACHE_PATH . DIRECTORY_SEPARATOR . 'test-save.php');
39
    }
40
41 View Code Duplication
    public function test_saveData()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
    {
43
        $manager = new Manager();
44
        $data = [1, 2];
45
        $manager->saveData('test-save', $data);
46
        self::assertFileExists(CACHE_PATH . DIRECTORY_SEPARATOR . 'test-save.php');
47
48
        $manager = new Manager();
49
        $manager->setActive(true);
50
        self::assertSame($data, $manager->get('test-save'));
51
52
        unlink(CACHE_PATH . DIRECTORY_SEPARATOR . 'test-save.php');
53
    }
54
}
55