@@ -69,19 +69,12 @@ public function setUp()
69
69
public function testConvert ()
70
70
{
71
71
$ methodInterface = $ this ->getMock ('Magento\Payment\Model\MethodInterface ' , [], [], '' , false );
72
- $ orderPayment = $ this ->getMockForAbstractClass (
73
- 'Magento\Sales\Api\Data\OrderPaymentInterface ' ,
74
- [],
75
- '' ,
76
- false ,
77
- true ,
78
- true ,
79
- ['setCcNumberEnc ' , 'setCcCidEnc ' , 'setAdditionalInformation ' ]
80
- );
72
+
81
73
$ paymentData = ['test ' => 'test2 ' ];
82
74
$ data = ['some_id ' => 1 ];
83
75
$ paymentMethodTitle = 'TestTitle ' ;
84
76
$ additionalInfo = ['token ' => 'TOKEN-123 ' ];
77
+
85
78
$ this ->paymentMock ->expects ($ this ->once ())->method ('getMethodInstance ' )->willReturn ($ methodInterface );
86
79
$ methodInterface ->expects ($ this ->once ())->method ('getTitle ' )->willReturn ($ paymentMethodTitle );
87
80
$ this ->objectCopyMock ->expects ($ this ->once ())->method ('getDataFromFieldset ' )->with (
@@ -99,28 +92,35 @@ public function testConvert()
99
92
->willReturn ($ additionalInfo );
100
93
$ ccNumber = 123456798 ;
101
94
$ ccCid = 1234 ;
102
- $ this ->paymentMock ->expects ($ this ->once ())
95
+ $ this ->paymentMock ->expects ($ this ->any ())
103
96
->method ('getCcNumber ' )
104
97
->willReturn ($ ccNumber );
105
- $ this ->paymentMock ->expects ($ this ->once ())
106
- ->method ('getCcCidEnc ' )
98
+ $ this ->paymentMock ->expects ($ this ->any ())
99
+ ->method ('getCcCid ' )
107
100
->willReturn ($ ccCid );
108
101
109
- $ this ->orderPaymentFactoryMock ->expects ($ this ->once ())->method ('create ' )->willReturn ($ orderPayment );
110
-
102
+ $ orderPayment = $ this ->getMockForAbstractClass (
103
+ 'Magento\Sales\Api\Data\OrderPaymentInterface ' ,
104
+ [],
105
+ '' ,
106
+ false ,
107
+ true ,
108
+ true ,
109
+ ['setCcNumber ' , 'setCcCid ' , 'setAdditionalInformation ' ]
110
+ );
111
111
$ orderPayment ->expects ($ this ->once ())
112
112
->method ('setAdditionalInformation ' )
113
113
->with (serialize (array_merge ($ additionalInfo , [Substitution::INFO_KEY_TITLE => $ paymentMethodTitle ])))
114
114
->willReturnSelf ();
115
- $ orderPayment ->expects ($ this ->once ())
116
- ->method ('setCcNumberEnc ' )
117
- ->with ($ ccNumber )
115
+ $ orderPayment ->expects ($ this ->any ())
116
+ ->method ('setCcNumber ' )
118
117
->willReturnSelf ();
119
- $ orderPayment ->expects ($ this ->once ())
120
- ->method ('setCcCidEnc ' )
121
- ->with ($ ccCid )
118
+ $ orderPayment ->expects ($ this ->any ())
119
+ ->method ('setCcCid ' )
122
120
->willReturnSelf ();
123
121
122
+ $ this ->orderPaymentFactoryMock ->expects ($ this ->once ())->method ('create ' )->willReturn ($ orderPayment );
123
+
124
124
$ this ->assertSame ($ orderPayment , $ this ->converter ->convert ($ this ->paymentMock , $ data ));
125
125
}
126
126
}
0 commit comments