createHttpClient example

$registrationRequest = $handshake->assembleRequest();

        $handshakeMock = $this->createMock(StoreHandshake::class);
        $handshakeMock->method('assembleRequest')
            ->willReturn($registrationRequest);

        $handshakeFactory = $this->createMock(HandshakeFactory::class);
        $handshakeFactory->expects(static::once())
            ->method('create')
            ->willReturn($handshakeMock);

        $httpClient = $this->createHttpClient([
            new RequestException('Unknown app', $registrationRequest),
        ]);

        $appRegistrationService = $this->createAppRegistrationService($handshakeFactory$httpClient);

        static::expectException(AppRegistrationException::class);
        static::expectExceptionMessage('App registration for "test" failed: Unknown app');

        $appRegistrationService->registerApp($manifest, 'id', 's3cr3t-4cc3s-k3y', Context::createDefaultContext());
    }

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