public function testBatchingFlushesQueueAutomatically() { $events = [['event' => 'foo', 'properties' => ['bar' => 'baz']], ['event' => 'foo', 'properties' => ['bar' => 'baz']]]; foreach ($events as $event) { $this->client->track($event); } }
/** * Tests that the correct log file is used */ public function testLogFile() { $this->client->track(['userId' => 123, 'event' => 'foo', 'properties' => ['bar' => 'baz']]); $this->assertTrue(file_exists(sys_get_temp_dir() . "/segment-io.log")); $file = sys_get_temp_dir() . "/segment-io-test2.log"; $this->client = new Client(['write_key' => 123, 'max_queue_size' => 1, 'batching' => 'file', 'log_file' => sys_get_temp_dir() . "/segment-io-test2.log"]); $this->client->track(['userId' => 123, 'event' => 'foo', 'properties' => ['bar' => 'baz']]); $this->assertTrue(file_exists(sys_get_temp_dir() . "/segment-io-test2.log")); }