Skip to content

Commit 3eae809

Browse files
author
Alex Westergaard
committed
Add default params to events in tests
1 parent 80c0641 commit 3eae809

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/Unit/EventTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,12 @@ protected function assertEventFills(AbstractEvent $event)
420420
private function populateEventByFromArray(TypeEvent $event)
421421
{
422422
return $event::fromArray([
423+
'language' => 'en-US',
424+
'page_location' => '/',
425+
'page_referrer' => 'https://example.com/',
426+
'page_title' => 'Home - Site',
427+
'screen_resolution' => '1920x1080',
428+
// ---
423429
'currency' => $this->prefill['currency'],
424430
'value' => 9.99,
425431
'affiliation' => 'affiliation',
@@ -456,6 +462,12 @@ private function populateEventByFromArray(TypeEvent $event)
456462

457463
private function populateEventByArrayable(TypeEvent $event)
458464
{
465+
$event['language'] = 'en-US';
466+
$event['page_location'] = '/';
467+
$event['page_referrer'] = 'https://example.com/';
468+
$event['page_title'] = 'Home - Site';
469+
$event['screen_resolution'] = '1920x1080';
470+
459471
$event['currency'] = $this->prefill['currency'];
460472
$event['value'] = 9.99;
461473
$event['affiliation'] = 'affiliation';
@@ -496,6 +508,12 @@ private function populateEventByMethod(
496508
) {
497509
$params = $event->getAllParams();
498510

511+
$event->setLanguage('en-US');
512+
$event->setPageLocation('/');
513+
$event->setPageReferrer('https://example.com/');
514+
$event->setPageTitle('Home - Site');
515+
$event->setScreenResolution('1920x1080');
516+
499517
if (in_array('currency', $params)) {
500518
$event->setCurrency($this->prefill['currency']);
501519
if (in_array('value', $params)) {

0 commit comments

Comments
 (0)