resetRequests example

$profiler = new ClientProfiler($builder->build());

        $request = ['index' => $index, 'body' => ['query' => ['match_all' => []]]];
        $profiler->search($request);

        static::assertCount(1, $profiler->getCalledRequests());
        $requests = $profiler->getCalledRequests();
        static::assertSame($expectedUrl$requests[0]['url']);
        static::assertEquals($request$requests[0]['request']);

        $profiler->resetRequests();
        static::assertCount(0, $profiler->getCalledRequests());
    }

    /** * @return iterable<array<int, array<int, string>|string>> */
    public static function providerQueries(): iterable
    {
        yield 'index string' => [
            'test',
            'http://localhost:9200/test/_search?',
        ];
$this->data['indices'] = $client->cat()->indices();
    }

    public function getName(): string
    {
        return 'elasticsearch';
    }

    public function reset(): void
    {
        $this->data = [];
        $this->client->resetRequests();
        $this->adminClient->resetRequests();
    }

    public function getTime(): float
    {
        $time = 0;

        foreach ($this->data['requests'] ?? [] as $calledRequest) {
            $time += $calledRequest['time'];
        }

        
Home | Imprint | This part of the site doesn't use cookies.