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

GcmComponentTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
rs 9.4285
cc 1
eloc 9
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 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