-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathCustomProviderTest.php
More file actions
107 lines (81 loc) · 2.46 KB
/
CustomProviderTest.php
File metadata and controls
107 lines (81 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
namespace Uecode\Bundle\QPushBundle\Tests\Provider;
use Uecode\Bundle\QPushBundle\Provider\CustomProvider;
use Uecode\Bundle\QPushBundle\Tests\MockClient\CustomMockClient;
class CustomProviderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Uecode\Bundle\QPushBundle\Provider\SyncProvider
*/
private $provider;
/**
* @var \Monolog\Logger
*/
private $logger;
private $mock;
public function setUp()
{
$this->provider = $this->getCustomProvider();
}
public function testGetProvider()
{
$provider = $this->provider->getProvider();
$this->assertEquals('Custom', $provider);
}
public function testPublish()
{
$this->setNoOpExpectation();
$this->provider->publish(['foo' => 'bar']);
}
public function testCreate()
{
$this->setNoOpExpectation();
$this->provider->create();
}
public function testDestroy()
{
$this->setNoOpExpectation();
$this->provider->destroy();
}
public function testDelete()
{
$this->setNoOpExpectation();
$this->provider->delete('foo');
}
public function testReceive()
{
$this->setNoOpExpectation();
$this->provider->receive();
}
protected function getCustomProvider()
{
$options = [
'logging_enabled' => false,
'push_notifications' => true,
'push_notifications_only' => false,
'notification_retries' => 3,
'message_delay' => 0,
'message_timeout' => 30,
'message_expiration' => 604800,
'messages_to_receive' => 1,
'receive_wait_time' => 3,
'subscribers' => []
];
$cache = $this->getMock(
'Doctrine\Common\Cache\PhpFileCache',
[],
['/tmp', 'qpush.custom.test.php']
);
$this->logger = $this->getMock(
'Monolog\Logger', [], ['qpush.test']
);
$this->mock = new CustomMockClient('custom', $options, null, $cache, $this->logger);
return new CustomProvider('test', $options, $this->mock, $cache, $this->logger);
}
protected function setNoOpExpectation()
{
$this->logger
->expects($this->never())
->method(new \PHPUnit_Framework_Constraint_IsAnything());
}
}