1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the smsmode-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2019 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\SmsModeBundle\Tests; |
13
|
|
|
|
14
|
|
|
use DateTime; |
15
|
|
|
use WBW\Bundle\CoreBundle\Tests\AbstractTestCase as BaseTestCase; |
16
|
|
|
use WBW\Library\SmsMode\Api\SendingSmsBatchInterface as ApiSendingSmsBatchInterface; |
17
|
|
|
use WBW\Library\SmsMode\Api\SendingSmsMessageInterface as ApiSendingSmsMessageInterface; |
18
|
|
|
use WBW\Library\SmsMode\Api\SendingTextToSpeechSmsInterface as ApiSendingTextToSpeechSmsInterface; |
19
|
|
|
use WBW\Library\SmsMode\Entity\AddingContactInterface; |
20
|
|
|
use WBW\Library\SmsMode\Entity\CheckingSmsMessageStatusInterface; |
21
|
|
|
use WBW\Library\SmsMode\Entity\CreatingSubAccountInterface; |
22
|
|
|
use WBW\Library\SmsMode\Entity\DeletingSmsInterface; |
23
|
|
|
use WBW\Library\SmsMode\Entity\DeletingSubAccountInterface; |
24
|
|
|
use WBW\Library\SmsMode\Entity\DeliveryReportInterface; |
25
|
|
|
use WBW\Library\SmsMode\Entity\RetrievingSmsReplyInterface; |
26
|
|
|
use WBW\Library\SmsMode\Entity\SendingSmsBatchInterface; |
27
|
|
|
use WBW\Library\SmsMode\Entity\SendingSmsMessageInterface; |
28
|
|
|
use WBW\Library\SmsMode\Entity\SendingTextToSpeechSmsInterface; |
29
|
|
|
use WBW\Library\SmsMode\Entity\SendingUnicodeSmsInterface; |
30
|
|
|
use WBW\Library\SmsMode\Entity\SentSmsMessageListInterface; |
31
|
|
|
use WBW\Library\SmsMode\Entity\TransferringCreditsInterface; |
32
|
|
|
use WBW\Library\SmsMode\Request\SendingSmsBatchRequest; |
33
|
|
|
use WBW\Library\SmsMode\Request\SendingSmsMessageRequest; |
34
|
|
|
use WBW\Library\SmsMode\Request\SendingTextToSpeechSmsRequest; |
35
|
|
|
use WBW\Library\SmsMode\Request\SendingUnicodeSmsRequest; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Abstract test case. |
39
|
|
|
* |
40
|
|
|
* @author webeweb <https://github.com/webeweb> |
41
|
|
|
* @package WBW\Bundle\SmsModeBundle\Tests |
42
|
|
|
* @abstract |
43
|
|
|
*/ |
44
|
|
|
abstract class AbstractTestCase extends BaseTestCase { |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Adding contact. |
48
|
|
|
* |
49
|
|
|
* @var AddingContactInterface |
50
|
|
|
*/ |
51
|
|
|
protected $addingContact; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Checking SMS message status. |
55
|
|
|
* |
56
|
|
|
* @var CheckingSmsMessageStatusInterface |
57
|
|
|
*/ |
58
|
|
|
protected $checkingSmsMessageStatus; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Creating sub-account. |
62
|
|
|
* |
63
|
|
|
* @var CreatingSubAccountInterface |
64
|
|
|
*/ |
65
|
|
|
protected $creatingSubAccount; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Deleting SMS. |
69
|
|
|
* |
70
|
|
|
* @var DeletingSmsInterface |
71
|
|
|
*/ |
72
|
|
|
protected $deletingSms; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Deleting sub-account. |
76
|
|
|
* |
77
|
|
|
* @var DeletingSubAccountInterface |
78
|
|
|
*/ |
79
|
|
|
protected $deletingSubAccount; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Delivery report. |
83
|
|
|
* |
84
|
|
|
* @var DeliveryReportInterface |
85
|
|
|
*/ |
86
|
|
|
protected $deliveryReport; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Fichier. |
90
|
|
|
* |
91
|
|
|
* @var string |
92
|
|
|
*/ |
93
|
|
|
protected $fichier; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Retrieving SMS reply. |
97
|
|
|
* |
98
|
|
|
* @var RetrievingSmsReplyInterface |
99
|
|
|
*/ |
100
|
|
|
protected $retrievingSmsReply; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Sending SMS batch. |
104
|
|
|
* |
105
|
|
|
* @var SendingSmsBatchInterface |
106
|
|
|
*/ |
107
|
|
|
protected $sendingSmsBatch; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Sending SMS message. |
111
|
|
|
* |
112
|
|
|
* @var SendingSmsMessageInterface |
113
|
|
|
*/ |
114
|
|
|
protected $sendingSmsMessage; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Sending text-to-speech SMS. |
118
|
|
|
* |
119
|
|
|
* @var SendingTextToSpeechSmsInterface |
120
|
|
|
*/ |
121
|
|
|
protected $sendingTextToSpeechSms; |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Sending unicode SMS. |
125
|
|
|
* |
126
|
|
|
* @var SendingUnicodeSmsInterface |
127
|
|
|
*/ |
128
|
|
|
protected $sendingUnicodeSms; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Sent SMS message list. |
132
|
|
|
* |
133
|
|
|
* @var SentSmsMessageListInterface |
134
|
|
|
*/ |
135
|
|
|
protected $sentSmsMessageList; |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Transferring credits. |
139
|
|
|
* |
140
|
|
|
* @var TransferringCreditsInterface |
141
|
|
|
*/ |
142
|
|
|
protected $transferringCredits; |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* {inheritdoc} |
146
|
|
|
*/ |
147
|
|
|
protected function setUp(): void { |
148
|
|
|
parent::setUp(); |
149
|
|
|
|
150
|
|
|
// Set a fichier mock. |
151
|
|
|
$this->fichier = realpath(__DIR__ . "/../vendor/webeweb/smsmode-library/tests/Fixtures/Request/SendingSmsBatchRequest.csv"); |
152
|
|
|
|
153
|
|
|
// Set an Adding contact mock. |
154
|
|
|
$this->addingContact = $this->getMockBuilder(AddingContactInterface::class)->getMock(); |
|
|
|
|
155
|
|
|
$this->addingContact->expects($this->any())->method("getSmsModeDate")->willReturn(new DateTime("2019-02-05 18:00:00")); |
156
|
|
|
$this->addingContact->expects($this->any())->method("getSmsModeGroupes")->willReturn(["groupe1", "groupe2"]); |
157
|
|
|
$this->addingContact->expects($this->any())->method("getSmsModeMobile")->willReturn("33600000000"); |
158
|
|
|
$this->addingContact->expects($this->any())->method("getSmsModeNom")->willReturn("nom"); |
159
|
|
|
$this->addingContact->expects($this->any())->method("getSmsModeOther")->willReturn("other"); |
160
|
|
|
$this->addingContact->expects($this->any())->method("getSmsModePrenom")->willReturn("prenom"); |
161
|
|
|
$this->addingContact->expects($this->any())->method("getSmsModeSociete")->willReturn("societe"); |
162
|
|
|
|
163
|
|
|
// Set a Checking SMS message status mock. |
164
|
|
|
$this->checkingSmsMessageStatus = $this->getMockBuilder(CheckingSmsMessageStatusInterface::class)->getMock(); |
|
|
|
|
165
|
|
|
$this->checkingSmsMessageStatus->expects($this->any())->method("getSmsModeSmsID")->willReturn("smsID"); |
166
|
|
|
|
167
|
|
|
// Set a Creating sub-account mock. |
168
|
|
|
$this->creatingSubAccount = $this->getMockBuilder(CreatingSubAccountInterface::class)->getMock(); |
|
|
|
|
169
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeAdresse")->willReturn("adresse"); |
170
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeCodePostal")->willReturn("codePostal"); |
171
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeDate")->willReturn(new DateTime("2019-02-05 18:00:00")); |
172
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeEmail")->willReturn("email"); |
173
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeFax")->willReturn("33100000000"); |
174
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeMobile")->willReturn("33600000000"); |
175
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeNewPseudo")->willReturn("newPseudo"); |
176
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeNewPass")->willReturn("newPass"); |
177
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeNom")->willReturn("nom"); |
178
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModePrenom")->willReturn("prenom"); |
179
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeReference")->willReturn("reference"); |
180
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeSociete")->willReturn("societe"); |
181
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeTelephone")->willReturn("33100000000"); |
182
|
|
|
$this->creatingSubAccount->expects($this->any())->method("getSmsModeVille")->willReturn("ville"); |
183
|
|
|
|
184
|
|
|
// Set a Deleting SMS mock. |
185
|
|
|
$this->deletingSms = $this->getMockBuilder(DeletingSmsInterface::class)->getMock(); |
|
|
|
|
186
|
|
|
$this->deletingSms->expects($this->any())->method("getSmsModeNumero")->willReturn("33600000000"); |
187
|
|
|
$this->deletingSms->expects($this->any())->method("getSmsModeSmsID")->willReturn("smsID"); |
188
|
|
|
|
189
|
|
|
// Set a Deleting sub-account mock. |
190
|
|
|
$this->deletingSubAccount = $this->getMockBuilder(DeletingSubAccountInterface::class)->getMock(); |
|
|
|
|
191
|
|
|
$this->deletingSubAccount->expects($this->any())->method("getSmsModePseudoToDelete")->willReturn("pseudoToDelete"); |
192
|
|
|
|
193
|
|
|
// Set a Delivery report mock. |
194
|
|
|
$this->deliveryReport = $this->getMockBuilder(DeliveryReportInterface::class)->getMock(); |
|
|
|
|
195
|
|
|
$this->deliveryReport->expects($this->any())->method("getSmsModeSmsID")->willReturn("smsID"); |
196
|
|
|
|
197
|
|
|
// Set a Retrieving SMS reply mock. |
198
|
|
|
$this->retrievingSmsReply = $this->getMockBuilder(RetrievingSmsReplyInterface::class)->getMock(); |
|
|
|
|
199
|
|
|
$this->retrievingSmsReply->expects($this->any())->method("getSmsModeEndDate")->willReturn(new DateTime("2019-02-05 19:00:00")); |
200
|
|
|
$this->retrievingSmsReply->expects($this->any())->method("getSmsModeOffset")->willReturn(10); |
201
|
|
|
$this->retrievingSmsReply->expects($this->any())->method("getSmsModeStart")->willReturn(0); |
202
|
|
|
$this->retrievingSmsReply->expects($this->any())->method("getSmsModeStartDate")->willReturn(new DateTime("2019-02-05 18:00:00")); |
203
|
|
|
|
204
|
|
|
// Set a Sending SMS batch mock. |
205
|
|
|
$this->sendingSmsBatch = $this->getMockBuilder(SendingSmsBatchInterface::class)->getMock(); |
|
|
|
|
206
|
|
|
$this->sendingSmsBatch->expects($this->any())->method("getSmsModeClasseMsg")->willReturn(ApiSendingSmsBatchInterface::CLASSE_MSG_SMS); |
207
|
|
|
$this->sendingSmsBatch->expects($this->any())->method("getSmsModeDateEnvoi")->willReturn(new DateTime("2019-02-05 18:00:00")); |
208
|
|
|
$this->sendingSmsBatch->expects($this->any())->method("getSmsModeEmetteur")->willReturn("emetteur"); |
209
|
|
|
$this->sendingSmsBatch->expects($this->any())->method("getSmsModeFichier")->willReturn($this->fichier); |
210
|
|
|
$this->sendingSmsBatch->expects($this->any())->method("getSmsModeNbrMsg")->willReturn(1); |
211
|
|
|
$this->sendingSmsBatch->expects($this->any())->method("getSmsModeNotificationUrl")->willReturn("notificationUrl"); |
212
|
|
|
$this->sendingSmsBatch->expects($this->any())->method("getSmsModeRefClient")->willReturn("refClient"); |
213
|
|
|
|
214
|
|
|
// Set a Sending SMS message mock. |
215
|
|
|
$this->sendingSmsMessage = $this->getMockBuilder(SendingSmsMessageInterface::class)->getMock(); |
|
|
|
|
216
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeClasseMsg")->willReturn(ApiSendingSmsBatchInterface::CLASSE_MSG_SMS); |
217
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeDateEnvoi")->willReturn(new DateTime("2019-02-05 18:00:00")); |
218
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeEmetteur")->willReturn("emetteur"); |
219
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeGroupe")->willReturn("groupe"); |
220
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeMessage")->willReturn("message"); |
221
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeNbrMsg")->willReturn(1); |
222
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeNotificationUrl")->willReturn("notificationUrl"); |
223
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeNotificationUrlReponse")->willReturn("notificationUrlReponse"); |
224
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeNumero")->willReturn(["33600000000"]); |
225
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeRefClient")->willReturn("refClient"); |
226
|
|
|
$this->sendingSmsMessage->expects($this->any())->method("getSmsModeStop")->willReturn(ApiSendingSmsMessageInterface::STOP_ALWAYS); |
227
|
|
|
|
228
|
|
|
// Set a Sending text-to-speech SMS mock. |
229
|
|
|
$this->sendingTextToSpeechSms = $this->getMockBuilder(SendingTextToSpeechSmsInterface::class)->getMock(); |
|
|
|
|
230
|
|
|
$this->sendingTextToSpeechSms->expects($this->any())->method("getSmsModeDateEnvoi")->willReturn(new DateTime("2019-02-05 18:00:00")); |
231
|
|
|
$this->sendingTextToSpeechSms->expects($this->any())->method("getSmsModeMessage")->willReturn("message"); |
232
|
|
|
$this->sendingTextToSpeechSms->expects($this->any())->method("getSmsModeNumero")->willReturn(["33600000000"]); |
233
|
|
|
$this->sendingTextToSpeechSms->expects($this->any())->method("getSmsModeLanguage")->willReturn(ApiSendingTextToSpeechSmsInterface::LANGUAGE_FR); |
234
|
|
|
$this->sendingTextToSpeechSms->expects($this->any())->method("getSmsModeTitle")->willReturn("title"); |
235
|
|
|
|
236
|
|
|
// Set a Sending unicode SMS mock. |
237
|
|
|
$this->sendingUnicodeSms = $this->getMockBuilder(SendingUnicodeSmsInterface::class)->getMock(); |
|
|
|
|
238
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeClasseMsg")->willReturn(ApiSendingSmsBatchInterface::CLASSE_MSG_SMS); |
239
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeDateEnvoi")->willReturn(new DateTime("2019-02-05 18:00:00")); |
240
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeEmetteur")->willReturn("emetteur"); |
241
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeGroupe")->willReturn("groupe"); |
242
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeMessage")->willReturn("message"); |
243
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeNbrMsg")->willReturn(1); |
244
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeNotificationUrl")->willReturn("notificationUrl"); |
245
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeNotificationUrlReponse")->willReturn("notificationUrlReponse"); |
246
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeNumero")->willReturn(["33600000000"]); |
247
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeRefClient")->willReturn("refClient"); |
248
|
|
|
$this->sendingUnicodeSms->expects($this->any())->method("getSmsModeStop")->willReturn(ApiSendingSmsMessageInterface::STOP_ALWAYS); |
249
|
|
|
|
250
|
|
|
// Set a Sent SMS message list mock. |
251
|
|
|
$this->sentSmsMessageList = $this->getMockBuilder(SentSmsMessageListInterface::class)->getMock(); |
|
|
|
|
252
|
|
|
$this->sentSmsMessageList->expects($this->any())->method("getSmsModeOffset")->willReturn(10); |
253
|
|
|
|
254
|
|
|
// Set a Transferring credits mock. |
255
|
|
|
$this->transferringCredits = $this->getMockBuilder(TransferringCreditsInterface::class)->getMock(); |
|
|
|
|
256
|
|
|
$this->transferringCredits->expects($this->any())->method("getSmsModeCreditAmount")->willReturn(212); |
257
|
|
|
$this->transferringCredits->expects($this->any())->method("getSmsModeReference")->willReturn("reference"); |
258
|
|
|
$this->transferringCredits->expects($this->any())->method("getSmsModeTargetPseudo")->willReturn("targetPseudo"); |
259
|
|
|
} |
260
|
|
|
} |
261
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..