Exemple #1
0
 public function testHeaders()
 {
     $authenticate = $this->getMockBuilder('AudioManager\\Adapter\\Ivona\\Authenticate')->disableOriginalConstructor()->setMethods(['getHeader', 'setPostData'])->getMock();
     $authenticate->method('setPostData')->with($this->anything())->will($this->returnSelf());
     $authenticate->method('getHeader')->with($this->stringContains(Payload::SERVICE_TYPE_SPEECH))->will($this->returnValue(['X-Amz-Date:', 'Authorization:']));
     $options = $this->getMockBuilder('AudioManager\\Adapter\\Ivona\\Options')->disableOriginalConstructor()->setMethods(['getAuthenticate', 'getPostData', 'getUserAgent'])->getMock();
     $options->method('getAuthenticate')->will($this->returnValue($authenticate));
     $options->method('getPostData')->will($this->returnValue(['data' => true]));
     $options->method('getUserAgent')->will($this->returnValue(Options::DEFAULT_USERAGENT));
     $expectedArray = ["Content-Type: application/json", "Host: tts.eu-west-1.ivonacloud.com", "User-Agent: TestClient 1.0", "X-Amz-Date:", "Authorization:"];
     $this->payload->setOptions($options);
     $headers = $this->payload->getHeaders(Payload::SERVICE_TYPE_SPEECH);
     $this->assertEquals($expectedArray, $headers);
 }