Completed
Branch develop (410e9a)
by Romain
03:11
created

GcmComponentTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 14 1
A testSend() 0 6 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 ker0x\CakeGcm\Controller\Component\GcmComponent;
10
11
class GcmComponentTest extends TestCase
12
{
13
    public $component = null;
14
    public $controller = null;
15
16
    public function setUp()
17
    {
18
        parent::setUp();
19
         // Setup our component and fake test controller
20
        $request = new Request();
21
        $response = new Response();
22
        $this->controller = $this->getMock(
23
            'Cake\Controller\Controller',
24
            [],
25
            [$request, $response]
26
        );
27
        $registry = new ComponentRegistry($this->controller);
28
        $this->component = new GcmComponent($registry);
29
    }
30
31
    public function testSend()
32
    {
33
        $this->component->send();
34
        $response = $this->component->response();
35
        $this->assertEquals(1, $response['success']);
36
    }
37
38
    public function tearDown()
39
    {
40
        parent::tearDown();
41
        // Clean up after we're done
42
        unset($this->component, $this->controller);
43
    }
44
}
45