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

GcmComponentTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 14 1
A testSendError() 0 5 1
A tearDown() 0 6 1
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