Completed
Branch develop (ae71f2)
by Romain
02:12
created

GcmComponentTest::testSendError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
namespace ker0x\CakeGcm\Test\TestCase\Controller\Component;
3
4
use Cake\Controller\Controller;
5
use Cake\Controller\ComponentRegistry;
6
use Cake\Network\Request;
7
use Cake\Network\Response;
8
use Cake\TestSuite\TestCase;
9
use \Exception;
10
use ker0x\CakeGcm\Controller\Component\GcmComponent;
11
12
class GcmComponentTest extends TestCase
13
{
14
    public $component = null;
15
16
    public $controller = null;
17
18
    public $ids = [];
19
20
21
    public function setUp()
22
    {
23
        parent::setUp();
24
         // Setup our component and fake test controller
25
        $request = new Request();
26
        $response = new Response();
27
        $this->controller = $this->getMock(
28
            'Cake\Controller\Controller',
29
            null,
30
            [$request, $response]
31
        );
32
        $registry = new ComponentRegistry($this->controller);
33
        $this->component = new GcmComponent($registry);
34
    }
35
36
    public function testSendError()
37
    {
38
        $isSend = $this->component->send($this->ids);
39
        $this->assertEquals(new Exception(), $isSend);
40
    }
41
42
    public function tearDown()
43
    {
44
        parent::tearDown();
45
        // Clean up after we're done
46
        unset($this->component, $this->controller);
47
    }
48
}
49