public function testSubmitBulkTranslation() { $bulk = array(array('text' => 'In the era of Siri', 'target_language' => 'pt'), array('text' => 'In the era of Siri', 'target_language' => 'es')); $res = $this->unbabel->submitBulkTranslation($bulk); $this->assertEquals($res->getStatusCode(), 202); $job = $res->json(); $jobids = array($job['objects'][0]['uid'], $job['objects'][1]['uid']); $this->checkSubmissionProgress($jobids); }
public function testItShouldSubmitMultipleTranslations() { $post_data = array('objects' => array($this->getRequestObject('Unbabel test string 1', 'en', 'pl'), $this->getRequestObject('Unbabel test string 2', 'en', 'zu'), $this->getRequestObject('Unbabel test string 3', 'en', 'fr'))); $this->httpDriver->expects($this->once())->method('patch')->with($this->unbabel->buildRequestUrl('/translation/'), $this->unbabel->getHeaders(), json_encode($post_data)); $this->unbabel->submitBulkTranslation(array(array('text' => 'Unbabel test string 1', 'target_language' => 'pl', 'source_language' => 'en'), array('text' => 'Unbabel test string 2', 'target_language' => 'zu', 'source_language' => 'en'), array('text' => 'Unbabel test string 3', 'target_language' => 'fr', 'source_language' => 'en')), array('callback_url' => 'http://unbabel.com/', 'formality' => 'Informal', 'instructions' => 'Go out of you way to be kind to somebody today.', 'text_format' => 'text')); }