Passed
Push — master ( edb799...f409da )
by Petr
07:56
created

SocketsTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
dl 0
loc 41
rs 10
c 1
b 0
f 0
wmc 6
1
<?php
2
3
namespace BasicTests;
4
5
6
use CommonTestClass;
7
use kalanis\RemoteRequest\Interfaces;
8
use kalanis\RemoteRequest\Sockets;
9
use kalanis\RemoteRequest\Translations;
10
11
12
class SocketsTest extends CommonTestClass
13
{
14
    public function testInit(): void
15
    {
16
        $lang = new Translations();
17
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\SharedInternal', Sockets\Factory::getPointer($lang, Interfaces\ISocket::SOCKET_INTERNAL));
18
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\Stream', Sockets\Factory::getPointer($lang, Interfaces\ISocket::SOCKET_STREAM));
19
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\Socket', Sockets\Factory::getPointer($lang, Interfaces\ISocket::SOCKET_SOCKET));
20
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\FSocket', Sockets\Factory::getPointer($lang, Interfaces\ISocket::SOCKET_FSOCKET));
21
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\PfSocket', Sockets\Factory::getPointer($lang, Interfaces\ISocket::SOCKET_PFSOCKET));
22
    }
23
24
    public function testSetSocket(): void
25
    {
26
        $pointer = new Sockets\Socket(new Translations());
27
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\Socket', $pointer);
28
    }
29
30
    public function testSetFsocket(): void
31
    {
32
        $pointer = new Sockets\FSocket(new Translations());
33
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\FSocket', $pointer);
34
    }
35
36
    public function testSetPfsocket(): void
37
    {
38
        $pointer = new Sockets\PfSocket(new Translations());
39
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\PfSocket', $pointer);
40
    }
41
42
    public function testSetStream(): void
43
    {
44
        $pointer = new Sockets\Stream(new Translations());
45
        $pointer->setContextOptions(['foo' => 'bar', 'baz' => 'eff']);
46
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\Stream', $pointer);
47
    }
48
49
    public function testSetSharedInternal(): void
50
    {
51
        $pointer = new Sockets\SharedInternal(new Translations());
52
        $this->assertInstanceOf('\kalanis\RemoteRequest\Sockets\SharedInternal', $pointer);
53
    }
54
}
55