ListTest::it_can_push_a_list()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 45
Code Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 45
rs 8.8571
cc 1
eloc 30
nc 1
nop 0
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