Skip to content

Commit

Permalink
fix: changing to utopia system
Browse files Browse the repository at this point in the history
  • Loading branch information
byawitz committed Sep 5, 2024
1 parent d2d9848 commit 702159e
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 35 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
"require": {
"php": ">=8.0",
"utopia-php/cli": "1.0.*"
"utopia-php/cli": "1.0.*",
"utopia-php/system": "0.8.*"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
Expand Down
106 changes: 81 additions & 25 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions tests/Analytics/AnalyticsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Utopia\Analytics\Adapter\Plausible;
use Utopia\Analytics\Event;
use Utopia\Http\Http;
use Utopia\System\System;

class AnalyticsTest extends TestCase
{
Expand All @@ -30,24 +31,24 @@ class AnalyticsTest extends TestCase

public function setUp(): void
{
$this->ga = new GoogleAnalytics(Http::getEnv('GA_TID') ?? '', Http::getEnv('GA_CID') ?? '');
$this->pa = new Plausible(Http::getEnv('PA_DOMAIN') ?? '', Http::getEnv('PA_APIKEY') ?? '', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', '192.168.0.1');
$this->orbit = new Orbit(Http::getEnv('OR_WORKSPACEID') ?? '', Http::getEnv('OR_APIKEY') ?? '', 'Utopia Testing Suite');
$this->mp = new Mixpanel(Http::getEnv('MP_PROJECT_TOKEN') ?? '');
$this->hs = new HubSpot(Http::getEnv('HS_APIKEY') ?? '');
$this->ga = new GoogleAnalytics(System::getEnv('GA_TID') ?? '', System::getEnv('GA_CID') ?? '');
$this->pa = new Plausible(System::getEnv('PA_DOMAIN') ?? '', System::getEnv('PA_APIKEY') ?? '', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', '192.168.0.1');
$this->orbit = new Orbit(System::getEnv('OR_WORKSPACEID') ?? '', System::getEnv('OR_APIKEY') ?? '', 'Utopia Testing Suite');
$this->mp = new Mixpanel(System::getEnv('MP_PROJECT_TOKEN') ?? '');
$this->hs = new HubSpot(System::getEnv('HS_APIKEY') ?? '');
}

/**
* @group Plausible
*/
public function testPlausible()
{
$pageviewEvent = new Event();
$pageviewEvent = new Event;
$pageviewEvent
->setType('pageview')
->setUrl('https://www.appwrite.io/docs/pageview123');

$normalEvent = new Event();
$normalEvent = new Event;
$normalEvent->setType('testEvent-'.chr(mt_rand(97, 122)).substr(md5(time()), 1, 5))
->setName('testEvent')
->setUrl('https://www.appwrite.io/docs/installation')
Expand Down Expand Up @@ -215,7 +216,7 @@ public function testHubSpotDeleteAccount($data)
*/
public function testOrbit(): void
{
$event = new Event();
$event = new Event;
$event->setType('testEvent')
->setName('testEvent')
->setUrl('https://www.appwrite.io/docs/installation')
Expand Down Expand Up @@ -251,7 +252,7 @@ public function testCleanup(): void
public function testMixpanel()
{
/** Create a simple track event */
$event = new Event();
$event = new Event;
$event
->setName('testEvent')
->setType('click')
Expand Down

0 comments on commit 702159e

Please sign in to comment.