|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of the FirebaseCloudMessagingBundle |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Artem Henvald <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Fresh\FirebaseCloudMessagingBundle\Tests\DependencyInjection; |
|
12
|
|
|
|
|
13
|
|
|
use Fresh\FirebaseCloudMessagingBundle\DependencyInjection\Configuration; |
|
14
|
|
|
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait; |
|
15
|
|
|
use PHPUnit\Framework\TestCase; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* ConfigurationTest. |
|
19
|
|
|
* |
|
20
|
|
|
* @author Artem Henvald <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
class ConfigurationTest extends TestCase |
|
23
|
|
|
{ |
|
24
|
|
|
use ConfigurationTestCaseTrait; |
|
25
|
|
|
|
|
26
|
|
|
public function testInvalidConfiguration() |
|
27
|
|
|
{ |
|
28
|
|
|
$this->assertConfigurationIsInvalid( |
|
29
|
|
|
[ |
|
30
|
|
|
[ |
|
31
|
|
|
'invalid_parameter' => 123, |
|
32
|
|
|
], |
|
33
|
|
|
], |
|
34
|
|
|
'invalid_parameter' |
|
35
|
|
|
); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function testValidDefaultConfiguration() |
|
39
|
|
|
{ |
|
40
|
|
|
$this->assertProcessedConfigurationEquals( |
|
41
|
|
|
[], |
|
42
|
|
|
[ |
|
43
|
|
|
'endpoint' => 'https://fcm.googleapis.com/fcm/send', |
|
44
|
|
|
'guzzle_timeout' => 50, |
|
45
|
|
|
] |
|
46
|
|
|
); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function testValidConfiguration() |
|
50
|
|
|
{ |
|
51
|
|
|
$this->assertProcessedConfigurationEquals( |
|
52
|
|
|
[ |
|
53
|
|
|
[ |
|
54
|
|
|
'sender_id' => 1234567890, |
|
55
|
|
|
'server_key' => 'some_key', |
|
56
|
|
|
], |
|
57
|
|
|
], |
|
58
|
|
|
[ |
|
59
|
|
|
'sender_id' => 1234567890, |
|
60
|
|
|
'server_key' => 'some_key', |
|
61
|
|
|
'endpoint' => 'https://fcm.googleapis.com/fcm/send', |
|
62
|
|
|
'guzzle_timeout' => 50, |
|
63
|
|
|
] |
|
64
|
|
|
); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
protected function getConfiguration() |
|
68
|
|
|
{ |
|
69
|
|
|
return new Configuration(); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|