@@ -118,12 +118,18 @@ public function testOrderTrackingCode()
118
118
'price': 0.00,
119
119
'quantity': 1
120
120
});
121
+ ga('ec:addProduct', {
122
+ 'id': 'sku1',
123
+ 'name': 'testName1',
124
+ 'price': 1.00,
125
+ 'quantity': 1.11
126
+ });
121
127
ga('ec:setAction', 'purchase', {
122
128
'id': '100',
123
129
'affiliation': 'test',
124
130
'revenue': 10.00,
125
131
'tax': 2.00,
126
- 'shipping': 1 .00
132
+ 'shipping': 2 .00
127
133
});
128
134
ga('send', 'pageview'); " ;
129
135
@@ -165,7 +171,7 @@ public function testOrderTrackingData()
165
171
'affiliation ' => 'test ' ,
166
172
'revenue ' => 10.00 ,
167
173
'tax ' => 2.00 ,
168
- 'shipping ' => 1
174
+ 'shipping ' => 2.0
169
175
]
170
176
],
171
177
'products ' => [
@@ -174,6 +180,12 @@ public function testOrderTrackingData()
174
180
'name ' => 'testName0 ' ,
175
181
'price ' => 0.00 ,
176
182
'quantity ' => 1
183
+ ],
184
+ [
185
+ 'id ' => 'sku1 ' ,
186
+ 'name ' => 'testName1 ' ,
187
+ 'price ' => 1.00 ,
188
+ 'quantity ' => 1.11
177
189
]
178
190
],
179
191
'currency ' => 'USD '
@@ -204,7 +216,7 @@ public function testGetPageTrackingData()
204
216
* @param int $orderItemCount
205
217
* @return Order|MockObject
206
218
*/
207
- protected function createOrderMock ($ orderItemCount = 1 )
219
+ protected function createOrderMock ($ orderItemCount = 2 )
208
220
{
209
221
$ orderItems = [];
210
222
for ($ i = 0 ; $ i < $ orderItemCount ; $ i ++) {
@@ -213,8 +225,8 @@ protected function createOrderMock($orderItemCount = 1)
213
225
->getMockForAbstractClass ();
214
226
$ orderItemMock ->expects ($ this ->once ())->method ('getSku ' )->willReturn ('sku ' . $ i );
215
227
$ orderItemMock ->expects ($ this ->once ())->method ('getName ' )->willReturn ('testName ' . $ i );
216
- $ orderItemMock ->expects ($ this ->once ())->method ('getPrice ' )->willReturn (round (( float )($ i . '.0000 ' ), 2 ));
217
- $ orderItemMock ->expects ($ this ->once ())->method ('getQtyOrdered ' )->willReturn ($ i + 1 );
228
+ $ orderItemMock ->expects ($ this ->once ())->method ('getPrice ' )->willReturn (( float )($ i . '.0000 ' ));
229
+ $ orderItemMock ->expects ($ this ->once ())->method ('getQtyOrdered ' )->willReturn ($ i == 1 ? 1.11 : $ i + 1 );
218
230
$ orderItems [] = $ orderItemMock ;
219
231
}
220
232
@@ -241,7 +253,7 @@ protected function createCollectionMock()
241
253
242
254
$ collectionMock ->expects ($ this ->any ())
243
255
->method ('getIterator ' )
244
- ->willReturn (new \ArrayIterator ([$ this ->createOrderMock (1 )]));
256
+ ->willReturn (new \ArrayIterator ([$ this ->createOrderMock (2 )]));
245
257
return $ collectionMock ;
246
258
}
247
259
0 commit comments