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 tests_missing_auth_sets_project_to_translated_user()
 {
     $this->params = array('project_name' => 'foo', 'target_lang' => 'it', 'source_lang' => 'en');
     $this->files[] = test_file_path('xliff/amex-test.docx.xlf');
     $response = $this->getResponse();
     $body = json_decode($response['body']);
     $project = Projects_ProjectDao::findById($body->id_project);
     $this->assertEquals($project->id_customer, ProjectManager::TRANSLATED_USER);
 }
 public function validate()
 {
     $this->project = Projects_ProjectDao::findById($this->id_project);
     if ($this->project == false) {
         return false;
     }
     if (!$this->validateFeatureEnabled()) {
         return false;
     }
     return $this->inProjectScope();
 }
 function testsCallOnValidProject()
 {
     $this->setValidProjectWithAllTranslatedSegments();
     $project = Projects_ProjectDao::findById($this->test_data->project->id_project);
     foreach ($this->test_data->chunks as $chunk) {
         integrationSetChunkAsComplete(array('params' => array('id_job' => $chunk->id, 'password' => $chunk->password)));
     }
     $project = Projects_ProjectDao::findById($this->test_data->project->id_project);
     $expected_jobs = array();
     foreach ($project->getJobs() as $job) {
         $expected_jobs[] = array('id' => $job->id, 'password' => $job->password, 'download_url' => "http://localhost/?action=downloadFile&id_job={$job->id}&password={$job->password}");
     }
     $expected = array('project_status' => array('id' => $this->test_data->project->id_project, 'jobs' => $expected_jobs, 'completed' => true));
     $test = new CurlTest();
     $test->path = '/api/v2/project-completion-status/' . $this->test_data->project->id_project;
     $test->method = 'GET';
     $test->headers = $this->test_data->headers;
     $response = $test->getResponse();
     $this->assertEquals(json_encode($expected), $response['body']);
 }
Beispiel #5
0
 public function getProject()
 {
     return Projects_ProjectDao::findById($this->id_project);
 }