getCalledRequests example

$context = $request->attributes->get(PlatformRequest::ATTRIBUTE_CONTEXT_OBJECT);
        $enabled = $this->enabled;
        $client = $this->client;

        if ($context instanceof Context && $context->getSource() instanceof AdminApiSource) {
            $enabled = $this->adminEnabled;
            $client = $this->adminClient;
        }

        $this->data = [
            'enabled' => $enabled,
            'requests' => $client->getCalledRequests(),
            'time' => 0,
        ];

        if (!$enabled) {
            return;
        }

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

        
'transfer_stats' => [
                'total_time' => 0,
            ],
            'effective_url' => 'http://localhost:9200/test/_search',
        ])));

        $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>> */
    
Home | Imprint | This part of the site doesn't use cookies.