NoteTest::it_can_push_a_note()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 33
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 33
rs 8.8571
cc 1
eloc 20
nc 1
nop 0
1
<?php
2
3
require_once 'base/PHPushbulletTestBase.php';
4
5
class NoteTest extends PHPushbulletTestBase
6
{
7
    /** @test */
8
9
    public function it_can_push_a_note()
10
    {
11
        $devices = [
12
            'devices' => [
13
                $this->getDevice('android'),
14
                $this->getDevice('chrome')
15
            ],
16
        ];
17
18
        $response = $this->pushResponse([
19
          'type'  => 'note',
20
          'title' => 'Reminder',
21
          'body'  => 'Do this thing',
22
        ]);
23
24
        $this->mock([
25
            $this->okResponse($devices),
26
            $this->okResponse($response),
27
        ]);
28
29
        $response = $this->pushbullet->device('Chrome')->note('Reminder', 'Do this thing');
30
31
        $this->assertInternalType('array', $response);
32
        $this->assertCount(1, $response);
33
34
        $first = reset($response);
35
36
        $this->assertSame('note', $first['type']);
37
        $this->assertSame('Reminder', $first['title']);
38
        $this->assertSame('Do this thing', $first['body']);
39
40
        $this->assertRequestHistory(['devices', 'pushes']);
41
    }
42
}
43