GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FileCacheTest   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 3
dl 0
loc 64
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A tearDown() 0 4 1
A cleanUp() 0 7 2
A testStoreNewObject() 0 6 1
A testReplaceObject() 0 7 1
A testRetrieveNonexistentObject() 0 4 1
A testDeleteObject() 0 7 1
A testDeleteNonExistentObject() 0 4 1
A testGetStats() 0 4 1
1
<?php
2
3
namespace JDesrosiers\Resourceful\FileCache\Test;
4
5
use JDesrosiers\Resourceful\FileCache\FileCache;
6
use Symfony\Component\Filesystem\Filesystem;
7
8
class FileCacheTest extends \PHPUnit_Framework_TestCase
9
{
10
    private $service;
11
    private $testDir;
12
13
    public function setUp()
14
    {
15
        $this->testDir = __DIR__ . "/test";
16
17
        $this->cleanUp();
18
        $this->service = new FileCache($this->testDir);
19
    }
20
21
    public function tearDown()
22
    {
23
        $this->cleanUp();
24
    }
25
26
    private function cleanUp()
27
    {
28
        $filesystem = new Filesystem();
29
        if ($filesystem->exists($this->testDir)) {
30
            $filesystem->remove($this->testDir);
31
        }
32
    }
33
34
    public function testStoreNewObject()
35
    {
36
        $this->service->save("foo", "bar");
37
38
        $this->assertEquals("bar", $this->service->fetch("foo"));
39
    }
40
41
    public function testReplaceObject()
42
    {
43
        $this->service->save("foo", "foo");
44
        $this->service->save("foo", "bar");
45
46
        $this->assertEquals("bar", $this->service->fetch("foo"));
47
    }
48
49
    public function testRetrieveNonexistentObject()
50
    {
51
        $this->assertFalse($this->service->fetch("foo"));
52
    }
53
54
    public function testDeleteObject()
55
    {
56
        $this->service->save("foo", "bar");
57
        $this->service->delete("foo");
58
59
        $this->assertFalse($this->service->fetch("foo"));
60
    }
61
62
    public function testDeleteNonExistentObject()
63
    {
64
        $this->service->delete("foo");
65
    }
66
67
    public function testGetStats()
68
    {
69
        $this->assertNull($this->service->getStats());
70
    }
71
}
72