1 | <?php |
||
12 | { |
||
13 | public $component = null; |
||
14 | |||
15 | public $controller = null; |
||
16 | |||
17 | public function setUp() |
||
18 | { |
||
19 | parent::setUp(); |
||
20 | // Setup our component and fake test controller |
||
21 | $request = new Request(); |
||
22 | $response = new Response(); |
||
23 | $this->controller = $this->getMock( |
||
24 | 'Cake\Controller\Controller', |
||
25 | null, |
||
26 | [$request, $response] |
||
27 | ); |
||
28 | $registry = new ComponentRegistry($this->controller); |
||
29 | $this->component = new GcmComponent($registry, [ |
||
30 | 'api' => [ |
||
31 | 'key' => getenv('GCM_API_KEY') |
||
32 | ], |
||
33 | 'http' => [ |
||
34 | 'ssl_verify_peer' => false, |
||
35 | 'ssl_verify_peer_name' => false, |
||
36 | 'ssl_verify_host' => false |
||
37 | ] |
||
38 | ]); |
||
39 | } |
||
40 | |||
41 | public function testSendNotification() |
||
42 | { |
||
43 | $tokens = getenv('TOKEN'); |
||
44 | |||
45 | $result = $this->component->sendNotification( |
||
46 | $tokens, |
||
47 | [ |
||
48 | 'title' => 'Hello World', |
||
49 | 'body' => 'My awesome Hello World!' |
||
115 |