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.

UnixDiskTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 23
c 1
b 0
f 1
dl 0
loc 47
rs 10
wmc 7

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testThrowWhenCommandFails() 0 9 2
A testInterface() 0 3 1
A testVolumes() 0 13 2
A testGet() 0 14 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Tests\Innmind\Server\Status\Server\Disk;
5
6
use Innmind\Server\Status\{
7
    Server\Disk\UnixDisk,
8
    Server\Disk,
9
    Server\Disk\Volume,
10
    Server\Disk\Volume\MountPoint,
11
    Exception\DiskUsageNotAccessible,
12
};
13
use Innmind\Immutable\Map;
14
use PHPUnit\Framework\TestCase;
15
16
class UnixDiskTest extends TestCase
17
{
18
    public function testInterface()
19
    {
20
        $this->assertInstanceOf(Disk::class, new UnixDisk);
21
    }
22
23
    public function testVolumes()
24
    {
25
        if (!in_array(PHP_OS, ['Darwin', 'Linux'])) {
26
            return;
27
        }
28
29
        $volumes = (new UnixDisk)->volumes();
30
31
        $this->assertInstanceOf(Map::class, $volumes);
32
        $this->assertSame('string', (string) $volumes->keyType());
33
        $this->assertSame(Volume::class, (string) $volumes->valueType());
34
        $this->assertTrue($volumes->size() > 0);
35
        $this->assertTrue($volumes->contains('/'));
36
    }
37
38
    public function testGet()
39
    {
40
        if (!in_array(PHP_OS, ['Darwin', 'Linux'])) {
41
            return;
42
        }
43
44
        $volume = (new UnixDisk)->get(new MountPoint('/'));
45
46
        $this->assertInstanceOf(Volume::class, $volume);
47
        $this->assertSame('/', $volume->mountPoint()->toString());
48
        $this->assertTrue($volume->size()->toInt() > 0);
49
        $this->assertTrue($volume->available()->toInt() > 0);
50
        $this->assertTrue($volume->used()->toInt() > 0);
51
        $this->assertTrue($volume->usage()->toFloat() > 0);
52
    }
53
54
    public function testThrowWhenCommandFails()
55
    {
56
        if (in_array(PHP_OS, ['Darwin', 'Linux'])) {
57
            return;
58
        }
59
60
        $this->expectException(DiskUsageNotAccessible::class);
61
62
        (new UnixDisk)->volumes();
63
    }
64
}
65