Passed
Pull Request — master (#9)
by Sergey
03:51
created

ClientTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 37
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGroup() 0 5 1
A setUp() 0 4 1
A testStream() 0 5 1
1
<?php
2
3
4
namespace Asiries335\redisSteamPhp\Tests;
5
6
use Asiries335\redisSteamPhp\Client;
7
use Asiries335\redisSteamPhp\ClientRedisStreamPhpInterface;
8
use Asiries335\redisSteamPhp\Stream;
9
use Asiries335\redisSteamPhp\StreamGroupConsumer;
10
use PHPUnit\Framework\TestCase;
11
12
class ClientTest extends TestCase
13
{
14
    private $client;
15
16
    /**
17
     * setUp
18
     *
19
     * @return void
20
     */
21
    public function setUp() : void
22
    {
23
        $connector  = \Mockery::mock(ClientRedisStreamPhpInterface::class);
24
        $this->client = new Client($connector);
0 ignored issues
show
Bug introduced by
$connector of type Mockery\LegacyMockInterface|Mockery\MockInterface is incompatible with the type Asiries335\redisSteamPhp...RedisStreamPhpInterface expected by parameter $redisClient of Asiries335\redisSteamPhp\Client::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

24
        $this->client = new Client(/** @scrutinizer ignore-type */ $connector);
Loading history...
25
    }
26
27
    /**
28
     * test Stream
29
     *
30
     * @return void
31
     */
32
    public function testStream() : void
33
    {
34
        $result = $this->client->stream('stream-name');
35
36
        $this->assertInstanceOf(Stream::class, $result);
37
    }
38
39
    /**
40
     * test Group
41
     *
42
     * @return void
43
     */
44
    public function testGroup() : void
45
    {
46
        $result = $this->client->streamGroupConsumer('stream-name');
47
48
        $this->assertInstanceOf(StreamGroupConsumer::class, $result);
49
    }
50
}