@@ -19,6 +19,7 @@ public function testEventAddPaymentInfo()
1919 $ this ->assertEventNaming ($ event );
2020 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
2121 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
22+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
2223 }
2324
2425 public function testAddPaymentInfo ()
@@ -27,6 +28,7 @@ public function testAddPaymentInfo()
2728 $ this ->assertEventNaming ($ event );
2829 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
2930 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
31+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
3032 }
3133
3234 public function testAddShippingInfo ()
@@ -35,6 +37,7 @@ public function testAddShippingInfo()
3537 $ this ->assertEventNaming ($ event );
3638 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
3739 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
40+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
3841 }
3942
4043 public function testAddToCart ()
@@ -43,6 +46,7 @@ public function testAddToCart()
4346 $ this ->assertEventNaming ($ event );
4447 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
4548 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
49+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
4650 }
4751
4852 public function testAddToWishlist ()
@@ -51,6 +55,7 @@ public function testAddToWishlist()
5155 $ this ->assertEventNaming ($ event );
5256 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
5357 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
58+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
5459 }
5560
5661 public function testBeginCheckout ()
@@ -59,6 +64,7 @@ public function testBeginCheckout()
5964 $ this ->assertEventNaming ($ event );
6065 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
6166 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
67+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
6268 }
6369
6470 public function testEarnVirtualCurrency ()
@@ -67,6 +73,7 @@ public function testEarnVirtualCurrency()
6773 $ this ->assertEventNaming ($ event );
6874 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
6975 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
76+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
7077 }
7178
7279 public function testGenerateLead ()
@@ -75,6 +82,7 @@ public function testGenerateLead()
7582 $ this ->assertEventNaming ($ event );
7683 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
7784 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
85+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
7886 }
7987
8088 public function testJoinGroup ()
@@ -83,6 +91,7 @@ public function testJoinGroup()
8391 $ this ->assertEventNaming ($ event );
8492 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
8593 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
94+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
8695 }
8796
8897 public function testLevelUp ()
@@ -92,13 +101,15 @@ public function testLevelUp()
92101 $ this ->assertEventNaming ($ event );
93102 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
94103 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
104+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
95105 }
96106 public function testLogin ()
97107 {
98108 $ event = new Event \Login ;
99109 $ this ->assertEventNaming ($ event );
100110 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
101111 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
112+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
102113 }
103114
104115 public function testPostScore ()
@@ -107,6 +118,7 @@ public function testPostScore()
107118 $ this ->assertEventNaming ($ event );
108119 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
109120 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
121+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
110122 }
111123
112124 public function testPurchase ()
@@ -115,6 +127,7 @@ public function testPurchase()
115127 $ this ->assertEventNaming ($ event );
116128 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
117129 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
130+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
118131 }
119132
120133 public function testRefund ()
@@ -123,6 +136,7 @@ public function testRefund()
123136 $ this ->assertEventNaming ($ event );
124137 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
125138 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
139+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
126140 }
127141
128142 public function testEventFullRefundRequiresNoItems ()
@@ -164,6 +178,7 @@ public function testRemoveFromCart()
164178 $ this ->assertEventNaming ($ event );
165179 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
166180 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
181+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
167182 }
168183
169184 public function testSearch ()
@@ -172,6 +187,7 @@ public function testSearch()
172187 $ this ->assertEventNaming ($ event );
173188 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
174189 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
190+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
175191 }
176192
177193 public function testSelectContent ()
@@ -180,6 +196,7 @@ public function testSelectContent()
180196 $ this ->assertEventNaming ($ event );
181197 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
182198 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
199+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
183200 }
184201
185202 public function testSelectItem ()
@@ -188,6 +205,7 @@ public function testSelectItem()
188205 $ this ->assertEventNaming ($ event );
189206 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
190207 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
208+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
191209 }
192210
193211 public function testSelectPromotion ()
@@ -196,6 +214,7 @@ public function testSelectPromotion()
196214 $ this ->assertEventNaming ($ event );
197215 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
198216 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
217+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
199218 }
200219
201220 public function testShare ()
@@ -204,6 +223,7 @@ public function testShare()
204223 $ this ->assertEventNaming ($ event );
205224 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
206225 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
226+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
207227 }
208228
209229 public function testSignup ()
@@ -212,6 +232,7 @@ public function testSignup()
212232 $ this ->assertEventNaming ($ event );
213233 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
214234 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
235+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
215236 }
216237
217238 public function testSpendVirtualCurrency ()
@@ -220,6 +241,7 @@ public function testSpendVirtualCurrency()
220241 $ this ->assertEventNaming ($ event );
221242 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
222243 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
244+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
223245 }
224246
225247 public function testTutorialBegin ()
@@ -228,6 +250,7 @@ public function testTutorialBegin()
228250 $ this ->assertEventNaming ($ event );
229251 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
230252 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
253+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
231254 }
232255
233256 public function testTutorialComplete ()
@@ -236,6 +259,7 @@ public function testTutorialComplete()
236259 $ this ->assertEventNaming ($ event );
237260 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
238261 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
262+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
239263 }
240264
241265 public function testUnlockAchievement ()
@@ -244,6 +268,7 @@ public function testUnlockAchievement()
244268 $ this ->assertEventNaming ($ event );
245269 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
246270 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
271+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
247272 }
248273
249274 public function testViewCart ()
@@ -252,6 +277,7 @@ public function testViewCart()
252277 $ this ->assertEventNaming ($ event );
253278 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
254279 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
280+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
255281 }
256282
257283 public function testViewItem ()
@@ -260,6 +286,7 @@ public function testViewItem()
260286 $ this ->assertEventNaming ($ event );
261287 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
262288 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
289+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
263290 }
264291
265292 public function testViewItemList ()
@@ -268,6 +295,7 @@ public function testViewItemList()
268295 $ this ->assertEventNaming ($ event );
269296 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
270297 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
298+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
271299 }
272300
273301 public function testViewPromotion ()
@@ -276,6 +304,7 @@ public function testViewPromotion()
276304 $ this ->assertEventNaming ($ event );
277305 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
278306 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
307+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
279308 }
280309
281310 public function testViewSearchResults ()
@@ -284,6 +313,7 @@ public function testViewSearchResults()
284313 $ this ->assertEventNaming ($ event );
285314 $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
286315 $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
316+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
287317 }
288318
289319 protected function assertEventNaming ($ event )
@@ -315,11 +345,45 @@ protected function assertEventFills(AbstractEvent $event)
315345 }
316346 }
317347
318- private function populateEventByArrayable (
319- TypeEvent |Group \AddPaymentInfo |Group \AddShippingInfo |Group \AddToCart |Group \AddToWishlist |Group \Analytics |Group \BeginCheckout |Group \EarnVirtualCurrency |Group \Export |Group \GenerateLead |Group \Item |Group \JoinGroup |Group \LevelUp |Group \Login |Group \PostScore |Group \Purchase |Group \Refund |Group \RemoveFromCart |Group \Search |Group \SelectContent |Group \SelectItem |Group \SelectPromotion |Group \Share |Group \SignUp |Group \SpendVirtualCurrency |Group \UnlockAchievement |Group \ViewCart |Group \ViewItem |Group \ViewItemList |Group \ViewPromotion |Group \ViewSearchResults |Group \hasItems $ event
320- ) {
321- $ params = $ event ->getAllParams ();
322-
348+ private function populateEventByFromArray (TypeEvent $ event )
349+ {
350+ return $ event ::fromArray ([
351+ 'currency ' => $ this ->prefill ['currency ' ],
352+ 'value ' => 9.99 ,
353+ 'affiliation ' => 'affiliation ' ,
354+ 'coupon ' => 'voucher-code ' ,
355+ 'price ' => 9.99 ,
356+ 'quantity ' => 10 ,
357+ 'payment_type ' => 'credit card ' ,
358+ 'tax ' => 2.22 ,
359+ 'shipping ' => 3.33 ,
360+ 'shipping_tier ' => 'ground ' ,
361+ 'item_id ' => 'item-id ' ,
362+ 'items ' => $ this ->item , // converts into either addItem() or setItem(), will not overwrite as [item]
363+ 'item_list_id ' => 'list-id ' ,
364+ 'item_list_name ' => 'list-name ' ,
365+ 'virtual_currency_name ' => $ this ->prefill ['currency_virtual ' ],
366+ 'value ' => 9.99 ,
367+ 'item_name ' => 'CookieBite ' ,
368+ 'character ' => 'AlexWestergaard ' ,
369+ 'level ' => 3 ,
370+ 'score ' => 500 ,
371+ 'location_id ' => 'ChIJeRpOeF67j4AR9ydy_PIzPuM ' ,
372+ 'transaction_id ' => 'O6435DK ' ,
373+ 'achievement_id ' => 'achievement_buy_5_items ' ,
374+ 'group_id ' => '999 ' ,
375+ 'method ' => 'some-method ' ,
376+ 'search_term ' => 'search ' ,
377+ 'content_type ' => 'content-type ' ,
378+ 'creative_name ' => 'creative-name ' ,
379+ 'creative_slot ' => 'creative-slot ' ,
380+ 'promotion_id ' => 'promotion-id ' ,
381+ 'promotion_name ' => 'promotion-name ' ,
382+ ]);
383+ }
384+
385+ private function populateEventByArrayable (TypeEvent $ event )
386+ {
323387 $ event ['currency ' ] = $ this ->prefill ['currency ' ];
324388 $ event ['value ' ] = 9.99 ;
325389 $ event ['affiliation ' ] = 'affiliation ' ;
0 commit comments