public function testRead() { $content = 'JSON'; $request = $this->getMockBuilder('AudioManager\\Request\\CurlRequest')->setMethods(['execute'])->getMock(); $request->method('execute')->will($this->returnValue($content)); $this->adapter->getOptions()->setLanguage('en'); $this->adapter->setHandle($request); $result = $this->adapter->read('text'); $this->assertEquals($content, $result); }
/** * @return \AudioManager\Adapter\AdapterInterface * @throws RuntimeException */ public function __invoke() { $adapterName = strtolower($this->config->get('voice.provider', self::VOICE_PROVIDER_GOOGLE)); switch ($adapterName) { case self::VOICE_PROVIDER_GOOGLE: $adapter = new Google(); $adapter->getOptions()->setLanguage('en'); $adapter->getOptions()->setEncoding('UTF-8'); break; case self::VOICE_PROVIDER_IVONA: $secretKey = $this->config->get('voice.' . $adapterName . '.secret_key', ''); $accessKey = $this->config->get('voice.' . $adapterName . '.access_key', ''); $adapter = new Ivona(); $adapter->getOptions()->setSecretKey($secretKey); $adapter->getOptions()->setAccessKey($accessKey); break; default: throw new ErrorException('Not implemented functionality for voice provider: ' . $adapterName); } return $adapter; }