ChannelTest::it_can_chain_channels()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 20
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
3
require_once 'base/PHPushbulletTestBase.php';
4
5
class ChannelTest extends PHPushbulletTestBase
6
{
7
    /** @test */
8
9
    public function it_can_chain_channels()
10
    {
11
        $response = $this->pushResponse([
12
                                          'type'  => 'note',
13
                                          'title' => 'Reminder',
14
                                          'body'  => 'Do this thing',
15
                                        ]);
16
17
        $this->mock([
18
            $this->okResponse($response),
19
            $this->okResponse($response),
20
        ]);
21
22
        $response = $this->pushbullet->channel('mychanneltag')->note('Title', 'Body');
23
24
        $this->assertInternalType('array', $response);
25
        $this->assertCount(1, $response);
26
27
        $this->assertRequestHistory(['pushes']);
28
    }
29
30
    /** @test */
31
32
    public function it_can_pass_multiple_channels()
33
    {
34
        $response = $this->pushResponse([
35
                                          'type'  => 'note',
36
                                          'title' => 'Reminder',
37
                                          'body'  => 'Do this thing',
38
                                        ]);
39
40
        $this->mock([
41
            $this->okResponse($response),
42
            $this->okResponse($response),
43
        ]);
44
45
        $response = $this->pushbullet->channel('mychanneltag', 'anotherchanneltag')->note('Title', 'Body');
46
47
        $this->assertInternalType('array', $response);
48
        $this->assertCount(2, $response);
49
50
        $this->assertRequestHistory(['pushes', 'pushes']);
51
    }
52
}
53