ApaiIO\Test\Request\Rest\GuzzleRequestTest::testSchemeSwitch PHP Method

testSchemeSwitch() public method

public testSchemeSwitch ( )
    public function testSchemeSwitch()
    {
        $body = $this->prophesize('\\Psr\\Http\\Message\\StreamInterface');
        $body->getContents()->shouldBeCalledTimes(1)->willReturn('ABC');
        $response = $this->prophesize('\\Psr\\Http\\Message\\ResponseInterface');
        $response->getBody()->shouldBeCalledTimes(1)->willReturn($body->reveal());
        $client = $this->prophesize('\\GuzzleHttp\\ClientInterface');
        $client->send(Argument::that(function ($request) {
            if (!$request instanceof RequestInterface) {
                return false;
            }
            $uri = $request->getUri();
            $this->assertSame('https', $uri->getScheme());
            return true;
        }))->shouldBeCalledTimes(1)->willReturn($response->reveal());
        $request = new GuzzleRequest($client->reveal());
        $request->setScheme('HTTPS');
        $operation = new Lookup();
        $operation->setItemId('1');
        $config = new GenericConfiguration();
        $config->setAccessKey('abc');
        $config->setAssociateTag('def');
        $config->setCountry('DE');
        $config->setSecretKey('ghi');
        $config->setAccessKey('jkl');
        $request->perform($operation, $config);
    }