-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #17405: [Braintree] Added unit test for instant purchase PayPal token formatter (by @rogyar) - #15335: Fixed issue #13480 - Unable to activate logs after switching from production mode to developer (by @jayankaghosh) - #15606: Fix #10687 - Product image roles disappearing (by @Scarraban) - #15720: Convert to string $option->getValue, in order to be compared with oth� (by @zamboten) - #16597: Save configurable product options after validation error (by @swnsma) - #16955: fix: remove disabled attribute on region list (by @DanielRuf) - #14537: #12250: View.xml is inheriting image sizes from paren� (by @quisse) - #17078: MAGETWO-84608: Cannot perform setup:install if Redis needs a password� (by @guillaumegiordana) - #15691: Fix #4803: Incorrect return value from Product Attribute Repository (by @cream-julian) - #16724: 16544: fixed behaviour when some of JS validation rules making fields� (by @VitaliyBoyko) Fixed GitHub Issues: - #13480: Unable to activate logs after switching from production mode to developer (reported by @VincentMarmiesse) has been fixed in #15335 by @jayankaghosh in 2.2-develop branch Related commits: 1. 540917e 2. c6aabf8 - #10687: Product image roles randomly disappear (reported by @boxyman) has been fixed in #15606 by @Scarraban in 2.2-develop branch Related commits: 1. a99e97e - #15028: Configurable product addtocart with restAPI not working as expected (reported by @yspeedwicked) has been fixed in #15720 by @zamboten in 2.2-develop branch Related commits: 1. 03298b3 - #7372: Product images gets removed from "Images And Videos" after validation alert. (reported by @candia) has been fixed in #16597 by @swnsma in 2.2-develop branch Related commits: 1. d866b18 2. bc00d8e - #13177: Can't save attributes on a configurable product (reported by @bambamboole) has been fixed in #16597 by @swnsma in 2.2-develop branch Related commits: 1. d866b18 2. bc00d8e - #12250: View.xml is inheriting image sizes from parent (so an optional field is replaced by the value of parent) (reported by @quisse) has been fixed in #14537 by @quisse in 2.2-develop branch Related commits: 1. ca47981 2. 951d5e8 3. 96c28a6 - #4803: Incorrect return value from Product Attribute Repository (reported by @samtay) has been fixed in #15691 by @cream-julian in 2.2-develop branch Related commits: 1. 4c1989e 2. 215be5a 3. 2639d0e 4. 43dd85e - #16544: Some of JS validation rules making fields required (reported by @VitaliyBoyko) has been fixed in #16724 by @VitaliyBoyko in 2.2-develop branch Related commits: 1. e189fc9 2. 2ed9af3 3. e71836b 4. c6a8fec
- Loading branch information
Showing
16 changed files
with
254 additions
and
58 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/PayPal/TokenFormatterTest.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,92 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Braintree\Test\Unit\Model\InstantPurchase\PayPal; | ||
|
||
use Magento\Braintree\Model\InstantPurchase\CreditCard\TokenFormatter as PaypalTokenFormatter; | ||
use Magento\Vault\Api\Data\PaymentTokenInterface; | ||
|
||
class TokenFormatterTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var PaymentTokenInterface|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $paymentTokenMock; | ||
|
||
/** | ||
* @var PaypalTokenFormatter | ||
*/ | ||
private $paypalTokenFormatter; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $tokenDetails = [ | ||
'type' => 'visa', | ||
'maskedCC' => '4444************9999', | ||
'expirationDate' => '07-07-2025' | ||
]; | ||
|
||
protected function setUp() | ||
{ | ||
$this->paymentTokenMock = $this->getMockBuilder(PaymentTokenInterface::class) | ||
->getMockForAbstractClass(); | ||
|
||
$this->paypalTokenFormatter = new PaypalTokenFormatter(); | ||
} | ||
|
||
public function testFormatPaymentTokenWithKnownCardType() | ||
{ | ||
$this->tokenDetails['type'] = key(PaypalTokenFormatter::$baseCardTypes); | ||
$this->paymentTokenMock->expects($this->once()) | ||
->method('getTokenDetails') | ||
->willReturn(json_encode($this->tokenDetails)); | ||
|
||
$formattedString = sprintf( | ||
'%s: %s, %s: %s (%s: %s)', | ||
__('Credit Card'), | ||
reset(PaypalTokenFormatter::$baseCardTypes), | ||
__('ending'), | ||
$this->tokenDetails['maskedCC'], | ||
__('expires'), | ||
$this->tokenDetails['expirationDate'] | ||
); | ||
|
||
self::assertEquals($formattedString, $this->paypalTokenFormatter->formatPaymentToken($this->paymentTokenMock)); | ||
} | ||
|
||
public function testFormatPaymentTokenWithUnknownCardType() | ||
{ | ||
$this->paymentTokenMock->expects($this->once()) | ||
->method('getTokenDetails') | ||
->willReturn(json_encode($this->tokenDetails)); | ||
|
||
$formattedString = sprintf( | ||
'%s: %s, %s: %s (%s: %s)', | ||
__('Credit Card'), | ||
$this->tokenDetails['type'], | ||
__('ending'), | ||
$this->tokenDetails['maskedCC'], | ||
__('expires'), | ||
$this->tokenDetails['expirationDate'] | ||
); | ||
|
||
self::assertEquals($formattedString, $this->paypalTokenFormatter->formatPaymentToken($this->paymentTokenMock)); | ||
} | ||
|
||
public function testFormatPaymentTokenWithWrongData() | ||
{ | ||
unset($this->tokenDetails['type']); | ||
|
||
$this->paymentTokenMock->expects($this->once()) | ||
->method('getTokenDetails') | ||
->willReturn(json_encode($this->tokenDetails)); | ||
self::expectException('\InvalidArgumentException'); | ||
|
||
$this->paypalTokenFormatter->formatPaymentToken($this->paymentTokenMock); | ||
} | ||
} |
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
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
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
Oops, something went wrong.