1
|
|
|
<?php |
2
|
|
|
declare(strict_types = 1); |
3
|
|
|
|
4
|
|
|
namespace Tests\Innmind\Server\Status\Servers; |
5
|
|
|
|
6
|
|
|
use Innmind\Server\Status\{ |
7
|
|
|
Servers\OSX, |
8
|
|
|
Server, |
9
|
|
|
Server\Cpu, |
10
|
|
|
Server\Memory, |
11
|
|
|
Server\LoadAverage, |
12
|
|
|
Server\Processes, |
13
|
|
|
Server\Disk |
14
|
|
|
}; |
15
|
|
|
use Innmind\TimeContinuum\Earth\Clock; |
16
|
|
|
use Innmind\Url\Path; |
17
|
|
|
use PHPUnit\Framework\TestCase; |
18
|
|
|
|
19
|
|
|
class OSXTest extends TestCase |
20
|
|
|
{ |
21
|
|
|
public function testInterface() |
22
|
|
|
{ |
23
|
|
|
$this->assertInstanceOf(Server::class, new OSX(new Clock)); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function testCpu() |
27
|
|
|
{ |
28
|
|
|
if (PHP_OS !== 'Darwin') { |
29
|
|
|
return; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
$this->assertInstanceOf(Cpu::class, (new OSX(new Clock))->cpu()); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function testMemory() |
36
|
|
|
{ |
37
|
|
|
if (PHP_OS !== 'Darwin') { |
38
|
|
|
return; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$this->assertInstanceOf(Memory::class, (new OSX(new Clock))->memory()); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function testProcesses() |
45
|
|
|
{ |
46
|
|
|
$this->assertInstanceOf(Processes::class, (new OSX(new Clock))->processes()); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function testLoadAverage() |
50
|
|
|
{ |
51
|
|
|
$this->assertInstanceOf(LoadAverage::class, (new OSX(new Clock))->loadAverage()); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function testDisk() |
55
|
|
|
{ |
56
|
|
|
$this->assertInstanceOf(Disk::class, (new OSX(new Clock))->disk()); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function testTmp() |
60
|
|
|
{ |
61
|
|
|
$server = new OSX(new Clock); |
62
|
|
|
|
63
|
|
|
$this->assertInstanceOf(Path::class, $server->tmp()); |
64
|
|
|
$this->assertSame(\sys_get_temp_dir(), $server->tmp()->toString()); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|