Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 16 | class QrBillTest extends TestCase |
||
| 17 | { |
||
| 18 | public function testMinimalSetupIsValid() |
||
| 19 | { |
||
| 20 | $qrBill = QrBill::create(); |
||
| 21 | |||
| 22 | $creditorInformation = (new CreditorInformation()) |
||
| 23 | ->setIban('CH9300762011623852957'); |
||
| 24 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 25 | |||
| 26 | $creditor = (new Creditor()) |
||
| 27 | ->setName('My Company Ltd.') |
||
| 28 | ->setStreet('Bahnhofstrasse') |
||
| 29 | ->setHouseNumber('1') |
||
| 30 | ->setPostalCode('8000') |
||
| 31 | ->setCity('Zürich') |
||
| 32 | ->setCountry('CH'); |
||
| 33 | $qrBill->setCreditor($creditor); |
||
| 34 | |||
| 35 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 36 | ->setAmount(25.90) |
||
| 37 | ->setCurrency('CHF') |
||
| 38 | ->setDueDate(new \DateTime('+30 days')); |
||
| 39 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 40 | |||
| 41 | $paymentReference = (new PaymentReference()) |
||
| 42 | ->setType(PaymentReference::TYPE_QR) |
||
| 43 | ->setReference('123456789012345678901234567'); |
||
| 44 | $qrBill->setPaymentReference($paymentReference); |
||
| 45 | |||
| 46 | $this->assertTrue($qrBill->isValid()); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @expectedException Sprain\SwissQrBill\Exception\InvalidQrBillDataException |
||
| 51 | */ |
||
| 52 | public function testCatchInvalidData() |
||
| 53 | { |
||
| 54 | $qrBill = QrBill::create(); |
||
| 55 | $qrBill->getQrCode(); |
||
| 56 | } |
||
| 57 | |||
| 58 | public function testCreditorInformationIsRequired() |
||
| 59 | { |
||
| 60 | $qrBill = QrBill::create(); |
||
| 61 | |||
| 62 | $creditor = (new Creditor()) |
||
| 63 | ->setName('My Company Ltd.') |
||
| 64 | ->setStreet('Bahnhofstrasse') |
||
| 65 | ->setHouseNumber('1') |
||
| 66 | ->setPostalCode('8000') |
||
| 67 | ->setCity('Zürich') |
||
| 68 | ->setCountry('CH'); |
||
| 69 | $qrBill->setCreditor($creditor); |
||
| 70 | |||
| 71 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 72 | ->setAmount(25.90) |
||
| 73 | ->setCurrency('CHF') |
||
| 74 | ->setDueDate(new \DateTime('+30 days')); |
||
| 75 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 76 | |||
| 77 | $paymentReference = (new PaymentReference()) |
||
| 78 | ->setType(PaymentReference::TYPE_QR) |
||
| 79 | ->setReference('123456789012345678901234567'); |
||
| 80 | $qrBill->setPaymentReference($paymentReference); |
||
| 81 | |||
| 82 | $this->assertSame(1, $qrBill->getViolations()->count()); |
||
| 83 | } |
||
| 84 | |||
| 85 | public function testCreditorInformationMustBeValid() |
||
| 86 | { |
||
| 87 | $qrBill = QrBill::create(); |
||
| 88 | |||
| 89 | $creditorInformation = (new CreditorInformation()) |
||
| 90 | ->setIban('INVALIDIBAN'); |
||
| 91 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 92 | |||
| 93 | $creditor = (new Creditor()) |
||
| 94 | ->setName('My Company Ltd.') |
||
| 95 | ->setStreet('Bahnhofstrasse') |
||
| 96 | ->setHouseNumber('1') |
||
| 97 | ->setPostalCode('8000') |
||
| 98 | ->setCity('Zürich') |
||
| 99 | ->setCountry('CH'); |
||
| 100 | $qrBill->setCreditor($creditor); |
||
| 101 | |||
| 102 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 103 | ->setAmount(25.90) |
||
| 104 | ->setCurrency('CHF') |
||
| 105 | ->setDueDate(new \DateTime('+30 days')); |
||
| 106 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 107 | |||
| 108 | $paymentReference = (new PaymentReference()) |
||
| 109 | ->setType(PaymentReference::TYPE_QR) |
||
| 110 | ->setReference('123456789012345678901234567'); |
||
| 111 | $qrBill->setPaymentReference($paymentReference); |
||
| 112 | |||
| 113 | $this->assertFalse($qrBill->isValid()); |
||
| 114 | } |
||
| 115 | |||
| 116 | public function testCreditorIsRequired() |
||
| 117 | { |
||
| 118 | $qrBill = QrBill::create(); |
||
| 119 | |||
| 120 | $creditorInformation = (new CreditorInformation()) |
||
| 121 | ->setIban('CH9300762011623852957'); |
||
| 122 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 123 | |||
| 124 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 125 | ->setAmount(25.90) |
||
| 126 | ->setCurrency('CHF') |
||
| 127 | ->setDueDate(new \DateTime('+30 days')); |
||
| 128 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 129 | |||
| 130 | $paymentReference = (new PaymentReference()) |
||
| 131 | ->setType(PaymentReference::TYPE_QR) |
||
| 132 | ->setReference('123456789012345678901234567'); |
||
| 133 | $qrBill->setPaymentReference($paymentReference); |
||
| 134 | |||
| 135 | $this->assertSame(1, $qrBill->getViolations()->count()); |
||
| 136 | } |
||
| 137 | |||
| 138 | public function testCreditorMustBeValid() |
||
| 139 | { |
||
| 140 | $qrBill = QrBill::create(); |
||
| 141 | |||
| 142 | $creditorInformation = (new CreditorInformation()) |
||
| 143 | ->setIban('CH9300762011623852957'); |
||
| 144 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 145 | |||
| 146 | $creditor = (new Creditor()) |
||
| 147 | // NO NAME! |
||
| 148 | ->setStreet('Bahnhofstrasse') |
||
| 149 | ->setHouseNumber('1') |
||
| 150 | ->setPostalCode('8000') |
||
| 151 | ->setCity('Zürich') |
||
| 152 | ->setCountry('CH'); |
||
| 153 | $qrBill->setCreditor($creditor); |
||
| 154 | |||
| 155 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 156 | ->setAmount(25.90) |
||
| 157 | ->setCurrency('CHF') |
||
| 158 | ->setDueDate(new \DateTime('+30 days')); |
||
| 159 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 160 | |||
| 161 | $paymentReference = (new PaymentReference()) |
||
| 162 | ->setType(PaymentReference::TYPE_QR) |
||
| 163 | ->setReference('123456789012345678901234567'); |
||
| 164 | $qrBill->setPaymentReference($paymentReference); |
||
| 165 | |||
| 166 | $this->assertFalse($qrBill->isValid()); |
||
| 167 | } |
||
| 168 | |||
| 169 | public function testPaymentAmountInformationIsRequired() |
||
| 170 | { |
||
| 171 | $qrBill = QrBill::create(); |
||
| 172 | |||
| 173 | $creditorInformation = (new CreditorInformation()) |
||
| 174 | ->setIban('CH9300762011623852957'); |
||
| 175 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 176 | |||
| 177 | $creditor = (new Creditor()) |
||
| 178 | ->setName('My Company Ltd.') |
||
| 179 | ->setStreet('Bahnhofstrasse') |
||
| 180 | ->setHouseNumber('1') |
||
| 181 | ->setPostalCode('8000') |
||
| 182 | ->setCity('Zürich') |
||
| 183 | ->setCountry('CH'); |
||
| 184 | $qrBill->setCreditor($creditor); |
||
| 185 | |||
| 186 | $paymentReference = (new PaymentReference()) |
||
| 187 | ->setType(PaymentReference::TYPE_QR) |
||
| 188 | ->setReference('123456789012345678901234567'); |
||
| 189 | $qrBill->setPaymentReference($paymentReference); |
||
| 190 | |||
| 191 | $this->assertSame(1, $qrBill->getViolations()->count()); |
||
| 192 | } |
||
| 193 | |||
| 194 | public function testPaymentAmountInformationMustBeValid() |
||
| 195 | { |
||
| 196 | $qrBill = QrBill::create(); |
||
| 197 | |||
| 198 | $creditorInformation = (new CreditorInformation()) |
||
| 199 | ->setIban('CH9300762011623852957'); |
||
| 200 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 201 | |||
| 202 | $creditor = (new Creditor()) |
||
| 203 | ->setName('My Company Ltd.') |
||
| 204 | ->setStreet('Bahnhofstrasse') |
||
| 205 | ->setHouseNumber('1') |
||
| 206 | ->setPostalCode('8000') |
||
| 207 | ->setCity('Zürich') |
||
| 208 | ->setCountry('CH'); |
||
| 209 | $qrBill->setCreditor($creditor); |
||
| 210 | |||
| 211 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 212 | ->setAmount(25.90) |
||
| 213 | ->setCurrency('USD') // INVALID CURRENCY |
||
| 214 | ->setDueDate(new \DateTime('+30 days')); |
||
| 215 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 216 | |||
| 217 | $paymentReference = (new PaymentReference()) |
||
| 218 | ->setType(PaymentReference::TYPE_QR) |
||
| 219 | ->setReference('123456789012345678901234567'); |
||
| 220 | $qrBill->setPaymentReference($paymentReference); |
||
| 221 | |||
| 222 | $this->assertFalse($qrBill->isValid()); |
||
| 223 | } |
||
| 224 | |||
| 225 | public function testPaymentReferenceIsRequired() |
||
| 226 | { |
||
| 227 | $qrBill = QrBill::create(); |
||
| 228 | |||
| 229 | $creditorInformation = (new CreditorInformation()) |
||
| 230 | ->setIban('CH9300762011623852957'); |
||
| 231 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 232 | |||
| 233 | $creditor = (new Creditor()) |
||
| 234 | ->setName('My Company Ltd.') |
||
| 235 | ->setStreet('Bahnhofstrasse') |
||
| 236 | ->setHouseNumber('1') |
||
| 237 | ->setPostalCode('8000') |
||
| 238 | ->setCity('Zürich') |
||
| 239 | ->setCountry('CH'); |
||
| 240 | $qrBill->setCreditor($creditor); |
||
| 241 | |||
| 242 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 243 | ->setAmount(25.90) |
||
| 244 | ->setCurrency('CHF') |
||
| 245 | ->setDueDate(new \DateTime('+30 days')); |
||
| 246 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 247 | |||
| 248 | $this->assertSame(1, $qrBill->getViolations()->count()); |
||
| 249 | } |
||
| 250 | |||
| 251 | public function testPaymentReferenceMustBeValid() |
||
| 252 | { |
||
| 253 | $qrBill = QrBill::create(); |
||
| 254 | |||
| 255 | $creditorInformation = (new CreditorInformation()) |
||
| 256 | ->setIban('CH9300762011623852957'); |
||
| 257 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 258 | |||
| 259 | $creditor = (new Creditor()) |
||
| 260 | ->setName('My Company Ltd.') |
||
| 261 | ->setStreet('Bahnhofstrasse') |
||
| 262 | ->setHouseNumber('1') |
||
| 263 | ->setPostalCode('8000') |
||
| 264 | ->setCity('Zürich') |
||
| 265 | ->setCountry('CH'); |
||
| 266 | $qrBill->setCreditor($creditor); |
||
| 267 | |||
| 268 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 269 | ->setAmount(25.90) |
||
| 270 | ->setCurrency('CHF') |
||
| 271 | ->setDueDate(new \DateTime('+30 days')); |
||
| 272 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 273 | |||
| 274 | $paymentReference = (new PaymentReference()) |
||
| 275 | ->setType(PaymentReference::TYPE_QR) |
||
| 276 | ->setReference('INVALID REFERENCE'); |
||
| 277 | $qrBill->setPaymentReference($paymentReference); |
||
| 278 | |||
| 279 | $this->assertFalse($qrBill->isValid()); |
||
| 280 | } |
||
| 281 | |||
| 282 | public function testHeaderIsRequired() |
||
| 283 | { |
||
| 284 | $qrBill = new QrBill(); |
||
| 285 | |||
| 286 | $creditorInformation = (new CreditorInformation()) |
||
| 287 | ->setIban('CH9300762011623852957'); |
||
| 288 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 289 | |||
| 290 | $creditor = (new Creditor()) |
||
| 291 | ->setName('My Company Ltd.') |
||
| 292 | ->setStreet('Bahnhofstrasse') |
||
| 293 | ->setHouseNumber('1') |
||
| 294 | ->setPostalCode('8000') |
||
| 295 | ->setCity('Zürich') |
||
| 296 | ->setCountry('CH'); |
||
| 297 | $qrBill->setCreditor($creditor); |
||
| 298 | |||
| 299 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 300 | ->setAmount(25.90) |
||
| 301 | ->setCurrency('CHF') |
||
| 302 | ->setDueDate(new \DateTime('+30 days')); |
||
| 303 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 304 | |||
| 305 | $paymentReference = (new PaymentReference()) |
||
| 306 | ->setType(PaymentReference::TYPE_QR) |
||
| 307 | ->setReference('123456789012345678901234567'); |
||
| 308 | $qrBill->setPaymentReference($paymentReference); |
||
| 309 | |||
| 310 | $this->assertSame(1, $qrBill->getViolations()->count()); |
||
| 311 | } |
||
| 312 | |||
| 313 | public function testHeaderMustBeValid() |
||
| 314 | { |
||
| 315 | $qrBill = new QrBill(); |
||
| 316 | |||
| 317 | $header = new Header(); |
||
| 318 | $qrBill->setHeader($header); // INVALID EMPTY HEADER |
||
| 319 | |||
| 320 | $creditorInformation = (new CreditorInformation()) |
||
| 321 | ->setIban('CH9300762011623852957'); |
||
| 322 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 323 | |||
| 324 | $creditor = (new Creditor()) |
||
| 325 | ->setName('My Company Ltd.') |
||
| 326 | ->setStreet('Bahnhofstrasse') |
||
| 327 | ->setHouseNumber('1') |
||
| 328 | ->setPostalCode('8000') |
||
| 329 | ->setCity('Zürich') |
||
| 330 | ->setCountry('CH'); |
||
| 331 | $qrBill->setCreditor($creditor); |
||
| 332 | |||
| 333 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 334 | ->setAmount(25.90) |
||
| 335 | ->setCurrency('CHF') |
||
| 336 | ->setDueDate(new \DateTime('+30 days')); |
||
| 337 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 338 | |||
| 339 | $paymentReference = (new PaymentReference()) |
||
| 340 | ->setType(PaymentReference::TYPE_QR) |
||
| 341 | ->setReference('123456789012345678901234567'); |
||
| 342 | $qrBill->setPaymentReference($paymentReference); |
||
| 343 | |||
| 344 | $this->assertFalse($qrBill->isValid()); |
||
| 345 | } |
||
| 346 | |||
| 347 | public function testOptionalUltimateCreditorCanBeSet() |
||
| 348 | { |
||
| 349 | $qrBill = QrBill::create(); |
||
| 350 | |||
| 351 | $creditorInformation = (new CreditorInformation()) |
||
| 352 | ->setIban('CH9300762011623852957'); |
||
| 353 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 354 | |||
| 355 | $creditor = (new Creditor()) |
||
| 356 | ->setName('My Company Ltd.') |
||
| 357 | ->setStreet('Bahnhofstrasse') |
||
| 358 | ->setHouseNumber('1') |
||
| 359 | ->setPostalCode('8000') |
||
| 360 | ->setCity('Zürich') |
||
| 361 | ->setCountry('CH'); |
||
| 362 | $qrBill->setCreditor($creditor); |
||
| 363 | |||
| 364 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 365 | ->setAmount(25.90) |
||
| 366 | ->setCurrency('CHF') |
||
| 367 | ->setDueDate(new \DateTime('+30 days')); |
||
| 368 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 369 | |||
| 370 | $paymentReference = (new PaymentReference()) |
||
| 371 | ->setType(PaymentReference::TYPE_QR) |
||
| 372 | ->setReference('123456789012345678901234567'); |
||
| 373 | $qrBill->setPaymentReference($paymentReference); |
||
| 374 | |||
| 375 | $ultimateCreditor = (new UltimateCreditor()) |
||
| 376 | ->setName('My Company Holding Ltd.') |
||
| 377 | ->setStreet('Bahnhofstrasse') |
||
| 378 | ->setHouseNumber('1') |
||
| 379 | ->setPostalCode('8000') |
||
| 380 | ->setCity('Zürich') |
||
| 381 | ->setCountry('CH'); |
||
| 382 | $qrBill->setUltimateCreditor($ultimateCreditor); |
||
| 383 | |||
| 384 | $this->assertTrue($qrBill->isValid()); |
||
| 385 | } |
||
| 386 | |||
| 387 | public function testOptionalUltimateCreditorMustBeValid() |
||
| 388 | { |
||
| 389 | $qrBill = QrBill::create(); |
||
| 390 | |||
| 391 | $creditorInformation = (new CreditorInformation()) |
||
| 392 | ->setIban('CH9300762011623852957'); |
||
| 393 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 394 | |||
| 395 | $creditor = (new Creditor()) |
||
| 396 | ->setName('My Company Ltd.') |
||
| 397 | ->setStreet('Bahnhofstrasse') |
||
| 398 | ->setHouseNumber('1') |
||
| 399 | ->setPostalCode('8000') |
||
| 400 | ->setCity('Zürich') |
||
| 401 | ->setCountry('CH'); |
||
| 402 | $qrBill->setCreditor($creditor); |
||
| 403 | |||
| 404 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 405 | ->setAmount(25.90) |
||
| 406 | ->setCurrency('CHF') |
||
| 407 | ->setDueDate(new \DateTime('+30 days')); |
||
| 408 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 409 | |||
| 410 | $paymentReference = (new PaymentReference()) |
||
| 411 | ->setType(PaymentReference::TYPE_QR) |
||
| 412 | ->setReference('123456789012345678901234567'); |
||
| 413 | $qrBill->setPaymentReference($paymentReference); |
||
| 414 | |||
| 415 | $ultimateCreditor = (new UltimateCreditor()) |
||
| 416 | // NO NAME! |
||
| 417 | ->setStreet('Bahnhofstrasse') |
||
| 418 | ->setHouseNumber('1') |
||
| 419 | ->setPostalCode('8000') |
||
| 420 | ->setCity('Zürich') |
||
| 421 | ->setCountry('CH'); |
||
| 422 | $qrBill->setUltimateCreditor($ultimateCreditor); |
||
| 423 | |||
| 424 | $this->assertFalse($qrBill->isValid()); |
||
| 425 | } |
||
| 426 | |||
| 427 | public function testOptionalUltimateDebtorCanBeSet() |
||
| 428 | { |
||
| 429 | $qrBill = QrBill::create(); |
||
| 430 | |||
| 431 | $creditorInformation = (new CreditorInformation()) |
||
| 432 | ->setIban('CH9300762011623852957'); |
||
| 433 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 434 | |||
| 435 | $creditor = (new Creditor()) |
||
| 436 | ->setName('My Company Ltd.') |
||
| 437 | ->setStreet('Bahnhofstrasse') |
||
| 438 | ->setHouseNumber('1') |
||
| 439 | ->setPostalCode('8000') |
||
| 440 | ->setCity('Zürich') |
||
| 441 | ->setCountry('CH'); |
||
| 442 | $qrBill->setCreditor($creditor); |
||
| 443 | |||
| 444 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 445 | ->setAmount(25.90) |
||
| 446 | ->setCurrency('CHF') |
||
| 447 | ->setDueDate(new \DateTime('+30 days')); |
||
| 448 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 449 | |||
| 450 | $paymentReference = (new PaymentReference()) |
||
| 451 | ->setType(PaymentReference::TYPE_QR) |
||
| 452 | ->setReference('123456789012345678901234567'); |
||
| 453 | $qrBill->setPaymentReference($paymentReference); |
||
| 454 | |||
| 455 | $ultimateDebtor = (new UltimateDebtor()) |
||
| 456 | ->setName('Thomas LeClaire') |
||
| 457 | ->setStreet('Rue examplaire') |
||
| 458 | ->setHouseNumber('22a') |
||
| 459 | ->setPostalCode('1000') |
||
| 460 | ->setCity('Lausanne') |
||
| 461 | ->setCountry('CH'); |
||
| 462 | $qrBill->setUltimateDebtor($ultimateDebtor); |
||
| 463 | |||
| 464 | $this->assertTrue($qrBill->isValid()); |
||
| 465 | } |
||
| 466 | |||
| 467 | public function testOptionalUltimateDebtorMustBeValid() |
||
| 468 | { |
||
| 469 | $qrBill = QrBill::create(); |
||
| 470 | |||
| 471 | $creditorInformation = (new CreditorInformation()) |
||
| 472 | ->setIban('CH9300762011623852957'); |
||
| 473 | $qrBill->setCreditorInformation($creditorInformation); |
||
| 474 | |||
| 475 | $creditor = (new Creditor()) |
||
| 476 | ->setName('My Company Ltd.') |
||
| 477 | ->setStreet('Bahnhofstrasse') |
||
| 478 | ->setHouseNumber('1') |
||
| 479 | ->setPostalCode('8000') |
||
| 480 | ->setCity('Zürich') |
||
| 481 | ->setCountry('CH'); |
||
| 482 | $qrBill->setCreditor($creditor); |
||
| 483 | |||
| 484 | $paymentAmountInformation = (new PaymentAmountInformation()) |
||
| 485 | ->setAmount(25.90) |
||
| 486 | ->setCurrency('CHF') |
||
| 487 | ->setDueDate(new \DateTime('+30 days')); |
||
| 488 | $qrBill->setPaymentAmountInformation($paymentAmountInformation); |
||
| 489 | |||
| 490 | $paymentReference = (new PaymentReference()) |
||
| 491 | ->setType(PaymentReference::TYPE_QR) |
||
| 492 | ->setReference('123456789012345678901234567'); |
||
| 493 | $qrBill->setPaymentReference($paymentReference); |
||
| 494 | |||
| 495 | $ultimateDebtor = (new UltimateDebtor()) |
||
| 496 | // NO NAME! |
||
| 497 | ->setStreet('Rue examplaire') |
||
| 498 | ->setHouseNumber('22a') |
||
| 499 | ->setPostalCode('1000') |
||
| 500 | ->setCity('Lausanne') |
||
| 501 | ->setCountry('CH'); |
||
| 502 | $qrBill->setUltimateDebtor($ultimateDebtor); |
||
| 503 | |||
| 504 | $this->assertFalse($qrBill->isValid()); |
||
| 505 | } |
||
| 506 | } |