ChannelTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 2
c 3
b 0
f 1
lcom 1
cbo 2
dl 0
loc 48
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_can_chain_channels() 0 20 1
A it_can_pass_multiple_channels() 0 20 1
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