Ejemplo n.º 1
0
 /**
  * Test the translate API call with Html content
  *
  * @return void
  */
 public function testTranslateHtml()
 {
     if ($this->__mockSocket) {
         $this->GoogleTranslate->useUserIp = false;
         $expected = array('langpair' => 'fr|en', 'format' => 'html', 'q' => '<strong>Bonjour</strong>', 'v' => '1.0', 'key' => 'myApiKey');
         $this->Http->expectOnce('post', array('http://ajax.googleapis.com/ajax/services/language/translate', $expected));
         $this->Http->setReturnValue('post', '{"responseData": {"translatedText":"<strong>Hello</strong>"}, "responseDetails": null, "responseStatus": 200}');
         $this->Http->response['status']['code'] = 200;
     }
     $result = $this->GoogleTranslate->translate('<strong>Bonjour</strong>', 'fre', 'en', true);
     $this->assertEqual($result, '<strong>Hello</strong>');
 }