function testNoteIsAssignedToAllMrkInTransUnit() { $options = array('files' => array(test_file_path('xliff/sdlxliff-with-mrk-and-note.xlf.sdlxliff'))); $body = integrationCreateTestProject($options); $this->assertNotNull($body->id_project); $this->assertNotNull($body->project_pass); // ensure one job is created $project = Projects_ProjectDao::findById($body->id_project); $jobs = $project->getJobs(); // expect one job is created $this->assertEquals(1, count($project->getJobs())); $chunks = $jobs[0]->getChunks(); $segments = $chunks[0]->getSegments(); // expect one segment per mrk $this->assertEquals(2, count($segments)); // expect the correct notes count $this->assertEquals(1, count($segments[0]->getNotes())); $this->assertEquals(1, count($segments[1]->getNotes())); // expect the same note text $notes_segment_one = $segments[0]->getNotes(); $notes_segment_two = $segments[1]->getNotes(); $this->assertEquals('Test note', $notes_segment_one[0]->note); $this->assertEquals('Test note', $notes_segment_two[0]->note); // expect the internal_id is saved appropriately $this->assertEquals($notes_segment_one[0]->internal_id, $notes_segment_two[0]->internal_id); }
function testStatusOnTranslated() { $project = integrationCreateTestProject(); $this->params = array('id_project' => $project->id_project, 'project_pass' => $project->project_pass); $chunksDao = new Chunks_ChunkDao(Database::obtain()); $chunks = $chunksDao->getByProjectID($project->id_project); $this->assertTrue(count($chunks) == 1); foreach ($chunks as $chunk) { $segments = $chunk->getSegments(); foreach ($segments as $segment) { integrationSetTranslation(array('id_segment' => $segment->id, 'id_job' => $chunk->id, 'password' => $chunk->password, 'status' => 'translated')); } } foreach ($chunks as $chunk) { $translations = $chunk->getTranslations(); $this->assertEquals(3, count($translations)); foreach ($translations as $translation) { $this->assertEquals('TRANSLATED', $translation->status); } } // iterate all segments and setTranslations $request = $this->makeRequest(); $response = json_decode($request['body']); }
private function submitProjectWithApiKeys() { $this->test_data->project = integrationCreateTestProject(array('headers' => $this->test_data->headers)); }