Skip to content

Commit

Permalink
Merge pull request #53 from utopia-php/feat-orbit-hotfix
Browse files Browse the repository at this point in the history
Add non-string tests and fixes to Orbit Adapter
  • Loading branch information
eldadfux authored Feb 20, 2024
2 parents 42b0545 + 85246e8 commit fd2c068
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Analytics/Adapter/Orbit.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public function send(Event $event): bool
return json_encode($value);
}

if (is_bool($value)) {
return $value ? 'true' : 'false';
}

return strval($value);
}, array_filter($event->getProps(), fn ($value) => ! is_null($value) && $value !== '')),
];
Expand Down
2 changes: 1 addition & 1 deletion tests/Analytics/AnalyticsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function testOrbit(): void
$event->setType('testEvent')
->setName('testEvent')
->setUrl('https://www.appwrite.io/docs/installation')
->setProps(['category' => 'testEvent', 'email' => 'analytics@utopiaphp.com', 'tags' => ['test', 'test2']]);
->setProps(['category' => 'testEvent', 'email' => 'analytics@utopiaphp.com', 'tags' => ['test', 'test2'], 'non_string' => false]);

$this->assertTrue($this->orbit->send($event));
$this->assertTrue($this->orbit->validate($event));
Expand Down

0 comments on commit fd2c068

Please sign in to comment.