public function setScheme($scheme) { if (!in_array($scheme = strtolower($scheme), ['http', 'https'])) { throw new \InvalidArgumentException('The scheme can only be http or https.'); } $this->scheme = $scheme; }
/** * @expectedException \InvalidArgumentException */ public function testSchemeSetterWithInvalidValue() { $client = $this->prophesize('\\GuzzleHttp\\ClientInterface'); $request = new GuzzleRequest($client->reveal()); $request->setScheme('ftp'); }