/** * @covers \OAuth\HTTPTransporterFactory::buildTransporter * @covers \OAuth\HTTPTransporterFactory::buildClient * @depends testBuildTransporterFromString */ public function testBuildTransporterClientArguments() { // set() method $browser = HTTPTransporterFactory::buildTransporter('FileGetContents', ['timeout' => 777]); $this->assertEquals(777, $browser->getClient()->getTimeout()); // setOption method $browser = HTTPTransporterFactory::buildTransporter('Curl', ['testOption' => 'yep']); // Property is protected, make it public to test $reflProperty = new \ReflectionProperty($browser->getClient(), 'options'); $reflProperty->setAccessible(true); $this->assertEquals('yep', $reflProperty->getValue($browser->getClient())['testOption']); }
/** * @param ClientInterface|Browser|string $httpTransporter * @param array $configuration Client configuration * @param array $constructorArguments Client constructor arguments * * @return ServiceFactory */ public function setHttpTransporter($httpTransporter, array $configuration = [], array $constructorArguments = []) { $this->httpTransporter = $httpTransporter instanceof Browser ? $httpTransporter : HTTPTransporterFactory::buildTransporter($httpTransporter, $configuration, $constructorArguments); return $this; }