Skip to content
Snippets Groups Projects
Commit 04a81e51 authored by Alex Akimov's avatar Alex Akimov
Browse files

MAGETWO-32811: GET /V1/carts/:cartId/selected-payment-methods service always...

MAGETWO-32811: GET /V1/carts/:cartId/selected-payment-methods service always return "cc_exp_year" even if it not needed
parent 3fe3f5ca
Branches
No related merge requests found
...@@ -279,7 +279,8 @@ class Payment extends \Magento\Payment\Model\Info implements \Magento\Quote\Api\ ...@@ -279,7 +279,8 @@ class Payment extends \Magento\Payment\Model\Info implements \Magento\Quote\Api\
*/ */
public function getCcExpYear() public function getCcExpYear()
{ {
return $this->getData('cc_exp_year'); $expirationYear = $this->getData('cc_exp_year') ?: null;
return $expirationYear;
} }
/** /**
......
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Quote\Model\Quote;
use Magento\TestFramework\Helper\ObjectManager;
class PaymentTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Payment
*/
private $model;
protected function setUp()
{
$objectManager = new ObjectManager($this);
$this->model = $objectManager->getObject(
'\Magento\Quote\Model\Quote\Payment'
);
}
/**
* @param int|string|null $databaseValue
* @param int|string|null $expectedValue
* @dataProvider yearValueDataProvider
*/
public function testGetCcExpYearReturnsValidValue($databaseValue, $expectedValue)
{
$this->model->setData('cc_exp_year', $databaseValue);
$this->assertEquals($expectedValue, $this->model->getCcExpYear());
}
/**
* @return array
*/
public function yearValueDataProvider()
{
return array(
array(null, null),
array(0, null),
array('0', null),
array(1939, 1939),
);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment