| 1 |
<?php |
| 2 |
|
| 3 |
namespace PostHog\Test; |
| 4 |
|
| 5 |
use PHPUnit\Framework\TestCase; |
| 6 |
use PostHog\Client; |
| 7 |
|
| 8 |
class ConsumerLibCurlTest extends TestCase |
| 9 |
{ |
| 10 |
private $client; |
| 11 |
|
| 12 |
public function setUp(): void |
| 13 |
{ |
| 14 |
date_default_timezone_set("UTC"); |
| 15 |
$this->client = new Client( |
| 16 |
"BrpS4SctoaCCsyjlnlun3OzyNJAafdlv__jUWaaJWXg", |
| 17 |
[ |
| 18 |
"consumer" => "lib_curl", |
| 19 |
"debug" => true, |
| 20 |
] |
| 21 |
); |
| 22 |
} |
| 23 |
|
| 24 |
public function testCapture(): void |
| 25 |
{ |
| 26 |
self::assertTrue( |
| 27 |
$this->client->capture( |
| 28 |
array( |
| 29 |
"distinctId" => "lib-curl-capture", |
| 30 |
"event" => "PHP Lib Curl'd\" Event", |
| 31 |
) |
| 32 |
) |
| 33 |
); |
| 34 |
} |
| 35 |
|
| 36 |
public function testIdentify(): void |
| 37 |
{ |
| 38 |
self::assertTrue( |
| 39 |
$this->client->identify( |
| 40 |
array( |
| 41 |
"distinctId" => "lib-curl-identify", |
| 42 |
"properties" => array( |
| 43 |
"loves_php" => false, |
| 44 |
"type" => "consumer lib-curl test", |
| 45 |
"birthday" => time(), |
| 46 |
), |
| 47 |
) |
| 48 |
) |
| 49 |
); |
| 50 |
} |
| 51 |
|
| 52 |
public function testAlias(): void |
| 53 |
{ |
| 54 |
self::assertTrue( |
| 55 |
$this->client->alias( |
| 56 |
array( |
| 57 |
"alias" => "lib-curl-alias", |
| 58 |
"distinctId" => "user-id", |
| 59 |
) |
| 60 |
) |
| 61 |
); |
| 62 |
} |
| 63 |
} |
| 64 |
|