Skip to content

Commit 17f89b7

Browse files
committed
Add generate_lead event
1 parent 26b6001 commit 17f89b7

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event;
6+
7+
use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\Traits\CreatesEmpty;
8+
use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\Traits\HasCurrency;
9+
use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\Traits\HasValue;
10+
11+
class GenerateLeadEvent extends Event
12+
{
13+
use CreatesEmpty;
14+
15+
use HasCurrency;
16+
17+
use HasValue;
18+
19+
public function getEventName(): string
20+
{
21+
return 'generate_lead';
22+
}
23+
24+
protected function getParameters(): array
25+
{
26+
return [
27+
'currency' => $this->currency,
28+
'value' => $this->value,
29+
];
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event;
6+
7+
/**
8+
* @covers \Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\GenerateLeadEvent
9+
*/
10+
final class GenerateLeadEventTest extends AbstractEventTestCase
11+
{
12+
protected function getEvent(): Event
13+
{
14+
return GenerateLeadEvent::create()
15+
->setCurrency('USD')
16+
->setValue(123.45)
17+
;
18+
}
19+
20+
protected function getExpectedJson(): string
21+
{
22+
return '{"name":"generate_lead","params":{"currency":"USD","value":123.45}}';
23+
}
24+
}

0 commit comments

Comments
 (0)