예제 #1
0
 public function it_generates_valid_url(SpeechInfoInterface $speech)
 {
     $speech->getUuid()->willReturn('12345');
     $speech->getLang()->willReturn('ru-RU');
     $speech->getTopic()->willReturn('notes');
     //TODO update this spec to use uri functions
     $this->generate($speech)->shouldHaveUrlParams(['url' => 'http://asr.yandex.net/asr_xml', 'uuid' => '12345', 'lang' => 'ru-RU', 'topic' => 'notes', 'key' => self::KEY]);
 }
예제 #2
0
 /**
  * @param SpeechInfoInterface $speech source of url parameters
  * @return UriInterface
  */
 public function generate(SpeechInfoInterface $speech)
 {
     $query = http_build_query(['uuid' => $speech->getUuid(), 'key' => $this->key, 'topic' => $speech->getTopic(), 'lang' => $speech->getLang()]);
     $request = new Uri($this->base);
     return $request->withQuery($query);
 }