-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3902 from magento-arcticfoxes/2.3-develop-pr
[2.3-develop] Sync with 2.3.1-release
- 2.4.8-beta1
- 2.4.7
- 2.4.7-p3
- 2.4.7-p2
- 2.4.7-p1
- 2.4.7-beta3
- 2.4.7-beta2
- 2.4.7-beta1
- 2.4.6
- 2.4.6-p8
- 2.4.6-p7
- 2.4.6-p6
- 2.4.6-p5
- 2.4.6-p4
- 2.4.6-p3
- 2.4.6-p2
- 2.4.6-p1
- 2.4.5
- 2.4.5-p10
- 2.4.5-p9
- 2.4.5-p8
- 2.4.5-p7
- 2.4.5-p6
- 2.4.5-p5
- 2.4.5-p4
- 2.4.5-p3
- 2.4.5-p2
- 2.4.5-p1
- 2.4.4
- 2.4.4-p11
- 2.4.4-p10
- 2.4.4-p9
- 2.4.4-p8
- 2.4.4-p7
- 2.4.4-p6
- 2.4.4-p5
- 2.4.4-p4
- 2.4.4-p3
- 2.4.4-p2
- 2.4.4-p1
- 2.4.3
- 2.4.3-p3
- 2.4.3-p2
- 2.4.3-p1
- 2.4.2
- 2.4.2-p2
- 2.4.2-p1
- 2.4.1
- 2.4.1-p1
- 2.4.0
- 2.4.0-p1
- 2.3.7
- 2.3.7-p4
- 2.3.7-p3
- 2.3.7-p2
- 2.3.7-p1
- 2.3.6
- 2.3.6-p1
- 2.3.5
- 2.3.5-p2
- 2.3.5-p1
- 2.3.4
- 2.3.4-p2
- 2.3.3
- 2.3.3-p1
- 2.3.2
- 2.3.2-p2
Showing
12 changed files
with
353 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
app/code/Magento/Authorizenet/Test/Unit/Model/Directpost/RequestTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Authorizenet\Test\Unit\Model\Directpost; | ||
|
||
use Magento\Authorizenet\Model\Directpost\Request; | ||
use Magento\Framework\Intl\DateTimeFactory; | ||
use PHPUnit_Framework_MockObject_MockObject as MockObject; | ||
|
||
class RequestTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var DateTimeFactory|MockObject | ||
*/ | ||
private $dateTimeFactory; | ||
|
||
/** | ||
* @var Request | ||
*/ | ||
private $requestModel; | ||
|
||
protected function setUp() | ||
{ | ||
$this->dateTimeFactory = $this->getMockBuilder(DateTimeFactory::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$dateTime = new \DateTime('2016-07-05 00:00:00', new \DateTimeZone('UTC')); | ||
$this->dateTimeFactory->method('create') | ||
->willReturn($dateTime); | ||
|
||
$this->requestModel = new Request([], $this->dateTimeFactory); | ||
} | ||
|
||
/** | ||
* @param string $signatureKey | ||
* @param string $expectedHash | ||
* @dataProvider signRequestDataProvider | ||
*/ | ||
public function testSignRequestData(string $signatureKey, string $expectedHash) | ||
{ | ||
/** @var \Magento\Authorizenet\Model\Directpost $paymentMethod */ | ||
$paymentMethod = $this->createMock(\Magento\Authorizenet\Model\Directpost::class); | ||
$paymentMethod->method('getConfigData') | ||
->willReturnMap( | ||
[ | ||
['test', null, true], | ||
['login', null, 'login'], | ||
['trans_key', null, 'trans_key'], | ||
['signature_key', null, $signatureKey], | ||
] | ||
); | ||
|
||
$this->requestModel->setConstantData($paymentMethod); | ||
$this->requestModel->signRequestData(); | ||
$signHash = $this->requestModel->getXFpHash(); | ||
|
||
$this->assertEquals($expectedHash, $signHash); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function signRequestDataProvider() | ||
{ | ||
return [ | ||
[ | ||
'signatureKey' => '3EAFCE5697C1B4B9748385C1FCD29D86F3B9B41C7EED85A3A01DFF65' . | ||
'70C8C29373C2A153355C3313CDF4AF723C0036DBF244A0821713A910024EE85547CEF37F', | ||
'expectedHash' => '719ED94DF5CF3510CB5531E8115462C8F12CBCC8E917BD809E8D40B4FF06' . | ||
'1E14953554403DD9813CCCE0F31B184EB4DEF558E9C0747505A0C25420372DB00BE1' | ||
], | ||
[ | ||
'signatureKey' => '', | ||
'expectedHash' => '3656211f2c41d1e4c083606f326c0460' | ||
], | ||
]; | ||
} | ||
} |
Oops, something went wrong.