diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Http/Client/ClientServiceTest.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/lib/Http/Client/ClientServiceTest.php b/tests/lib/Http/Client/ClientServiceTest.php index ed1165236aa..72281a0453c 100644 --- a/tests/lib/Http/Client/ClientServiceTest.php +++ b/tests/lib/Http/Client/ClientServiceTest.php @@ -14,12 +14,15 @@ namespace Test\Http\Client; use GuzzleHttp\Client as GuzzleClient; use GuzzleHttp\HandlerStack; use GuzzleHttp\Handler\CurlHandler; +use GuzzleHttp\Middleware; use OC\Http\Client\Client; use OC\Http\Client\ClientService; use OC\Http\Client\DnsPinMiddleware; +use OCP\Diagnostics\IEventLogger; use OCP\ICertificateManager; use OCP\IConfig; use OCP\Security\IRemoteHostValidator; +use Psr\Http\Message\RequestInterface; /** * Class ClientServiceTest @@ -37,17 +40,24 @@ class ClientServiceTest extends \Test\TestCase { ->willReturn(function () { }); $remoteHostValidator = $this->createMock(IRemoteHostValidator::class); + $eventLogger = $this->createMock(IEventLogger::class); $clientService = new ClientService( $config, $certificateManager, $dnsPinMiddleware, - $remoteHostValidator + $remoteHostValidator, + $eventLogger ); $handler = new CurlHandler(); $stack = HandlerStack::create($handler); $stack->push($dnsPinMiddleware->addDnsPinning()); + $stack->push(Middleware::tap(function (RequestInterface $request) use ($eventLogger) { + $eventLogger->start('http:request', $request->getMethod() . " request to " . $request->getRequestTarget()); + }, function () use ($eventLogger) { + $eventLogger->end('http:request'); + }), 'event logger'); $guzzleClient = new GuzzleClient(['handler' => $stack]); $this->assertEquals( |