client = new Client([ "url" => $url, "token" => "my-token", "bucket" => "my-bucket", "precision" => WritePrecision::NS, "org" => "my-org", "logFile" => $logFile ]); $this->writeApi = $this->client->createWriteApi($this->getWriteOptions()); $this->queryApi = $this->client->createQueryApi(); $this->mockHandler = new MockHandler(); $this->requests = []; $handlerStack = HandlerStack::create($this->mockHandler); $handlerStack->push(Middleware::history($this->requests)); $this->writeApi->http = $this->writeApi->configuredClient(new \GuzzleHttp\Client([ 'handler' => $handlerStack, ])); $this->queryApi->http = $this->writeApi->configuredClient(new \GuzzleHttp\Client([ 'handler' => $handlerStack, ])); } public function tearDown(): void { $this->client->close(); } protected function getWriteOptions(): ?array { return null; } }