perform() public method

public perform ( ApaiIO\Operations\OperationInterface $operation, ApaiIO\Configuration\ConfigurationInterface $configuration )
$operation ApaiIO\Operations\OperationInterface
$configuration ApaiIO\Configuration\ConfigurationInterface
Beispiel #1
0
 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);
 }