ListTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B it_can_push_a_list() 0 45 1
1
<?php
2
3
require_once 'base/PHPushbulletTestBase.php';
4
5
class ListTest extends PHPushbulletTestBase
6
{
7
    /** @test */
8
9
    public function it_can_push_a_list()
10
    {
11
        $devices = [
12
            'devices' => [
13
                $this->getDevice('android'),
14
                $this->getDevice('chrome')
15
            ],
16
        ];
17
18
        $response = $this->pushResponse([
19
          'type'  => 'list',
20
          'title' => 'My List',
21
          'items' => [
22
            'This',
23
            'That',
24
            'Other thing',
25
          ],
26
        ]);
27
28
        $this->mock([
29
            $this->okResponse($devices),
30
            $this->okResponse($response),
31
        ]);
32
33
        $response = $this->pushbullet->device('Chrome')->list('My List', [
34
            'This',
35
            'That',
36
            'Other thing',
37
        ]);
38
39
        $this->assertInternalType('array', $response);
40
        $this->assertCount(1, $response);
41
42
        $first = reset($response);
43
44
        $this->assertSame('list', $first['type']);
45
        $this->assertSame('My List', $first['title']);
46
        $this->assertSame([
47
                            'This',
48
                            'That',
49
                            'Other thing',
50
                          ], $first['items']);
51
52
        $this->assertRequestHistory(['devices', 'pushes']);
53
    }
54
}
55