Conditions | 1 |
Paths | 1 |
Total Lines | 112 |
Code Lines | 83 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
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 | } |
||
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..