File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed
app/code/Magento/Quote/Model/Quote
dev/tests/unit/testsuite/Magento/Quote/Model/Quote Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -279,7 +279,8 @@ public function getCcType()
279
279
*/
280
280
public function getCcExpYear ()
281
281
{
282
- return $ this ->getData ('cc_exp_year ' );
282
+ $ expirationYear = $ this ->getData ('cc_exp_year ' ) ?: null ;
283
+ return $ expirationYear ;
283
284
}
284
285
285
286
/**
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2015 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \Quote \Model \Quote ;
7
+
8
+ use Magento \TestFramework \Helper \ObjectManager ;
9
+
10
+ class PaymentTest extends \PHPUnit_Framework_TestCase
11
+ {
12
+ /**
13
+ * @var Payment
14
+ */
15
+ private $ model ;
16
+
17
+ protected function setUp ()
18
+ {
19
+ $ objectManager = new ObjectManager ($ this );
20
+ $ this ->model = $ objectManager ->getObject (
21
+ '\Magento\Quote\Model\Quote\Payment '
22
+ );
23
+ }
24
+
25
+ /**
26
+ * @param int|string|null $databaseValue
27
+ * @param int|string|null $expectedValue
28
+ * @dataProvider yearValueDataProvider
29
+ */
30
+ public function testGetCcExpYearReturnsValidValue ($ databaseValue , $ expectedValue )
31
+ {
32
+ $ this ->model ->setData ('cc_exp_year ' , $ databaseValue );
33
+ $ this ->assertEquals ($ expectedValue , $ this ->model ->getCcExpYear ());
34
+ }
35
+
36
+ /**
37
+ * @return array
38
+ */
39
+ public function yearValueDataProvider ()
40
+ {
41
+ return array (
42
+ array (null , null ),
43
+ array (0 , null ),
44
+ array ('0 ' , null ),
45
+ array (1939 , 1939 ),
46
+ );
47
+ }
48
+ }
You can’t perform that action at this time.
0 commit comments