|
24 | 24 | use Magento\Framework\Reflection\MethodsMap;
|
25 | 25 | use Magento\Framework\Reflection\TypeProcessor;
|
26 | 26 | use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
|
| 27 | +use Magento\Sales\Api\Data\OrderPaymentInterface; |
| 28 | +use Magento\Sales\Model\Order\Payment; |
27 | 29 | use PHPUnit\Framework\MockObject\MockObject;
|
28 | 30 | use PHPUnit\Framework\TestCase;
|
29 | 31 |
|
@@ -297,6 +299,67 @@ public function testPopulateWithArrayWithCustomAttributes(): void
|
297 | 299 | );
|
298 | 300 | }
|
299 | 301 |
|
| 302 | + /** |
| 303 | + * @return void |
| 304 | + */ |
| 305 | + public function testPopulateWithArrayWithOrderPaymentAttributes(): void |
| 306 | + { |
| 307 | + $method = 'companycredit'; |
| 308 | + $customerPaymentId = null; |
| 309 | + $additionalData = null; |
| 310 | + $poNumber = 'ReferenceNumber934829dek2'; |
| 311 | + $cc_type = "Debit"; |
| 312 | + $cc_number_enc = "393993138"; |
| 313 | + $cc_last_4 = "3982"; |
| 314 | + $cc_owner = "John Doe"; |
| 315 | + $cc_exp_month = "05"; |
| 316 | + $cc_exp_year = "24"; |
| 317 | + $cc_number = '1234567890'; |
| 318 | + $cc_cid = null; |
| 319 | + $cc_ss_issue = null; |
| 320 | + $cc_ss_start_month = "0"; |
| 321 | + $cc_ss_start_year = "0"; |
| 322 | + |
| 323 | + |
| 324 | + /** @var OrderPaymentInterface $orderPaymentObject */ |
| 325 | + $orderPaymentObject = $this->objectManager->getObject( |
| 326 | + Payment::class, |
| 327 | + ['dataObjectHelper' => $this->dataObjectHelper] |
| 328 | + ); |
| 329 | + |
| 330 | + $data = [ |
| 331 | + 'method' => $method, |
| 332 | + 'customer_payment_id' => $customerPaymentId, |
| 333 | + 'additionalData' => $additionalData, |
| 334 | + 'additionalInformation' => [], |
| 335 | + 'po_number' => $poNumber, |
| 336 | + 'cc_type' => $cc_type, |
| 337 | + 'cc_number_enc' => $cc_number_enc, |
| 338 | + 'cc_last_4' => $cc_last_4, |
| 339 | + 'cc_owner' => $cc_owner, |
| 340 | + 'cc_exp_month' => $cc_exp_month, |
| 341 | + 'cc_exp_year' => $cc_exp_year, |
| 342 | + 'cc_number' => $cc_number, |
| 343 | + 'cc_cid' => $cc_cid, |
| 344 | + 'cc_ss_issue' => $cc_ss_issue, |
| 345 | + 'cc_ss_start_month' => $cc_ss_start_month, |
| 346 | + 'cc_ss_start_year' => $cc_ss_start_year |
| 347 | + ]; |
| 348 | + $this->dataObjectHelper->populateWithArray( |
| 349 | + $orderPaymentObject, |
| 350 | + $data, |
| 351 | + OrderPaymentInterface::class |
| 352 | + ); |
| 353 | + $this->assertEquals($method, $orderPaymentObject->getMethod()); |
| 354 | + $this->assertEquals($cc_exp_month, $orderPaymentObject->getCcExpMonth()); |
| 355 | + $this->assertEquals($cc_exp_year, $orderPaymentObject->getCcExpYear()); |
| 356 | + $this->assertEquals($cc_last_4, $orderPaymentObject->getCcLast4()); |
| 357 | + $this->assertEquals($cc_owner, $orderPaymentObject->getCcOwner()); |
| 358 | + $this->assertEquals($cc_number_enc,$orderPaymentObject->getCcNumberEnc()); |
| 359 | + $this->assertEquals($poNumber, $orderPaymentObject->getPoNumber()); |
| 360 | + $this->assertEquals($cc_type, $orderPaymentObject->getCcType()); |
| 361 | + } |
| 362 | + |
300 | 363 | /**
|
301 | 364 | * @param array $data1
|
302 | 365 | * @param array $data2
|
|
0 commit comments