You are here

function TMGMTLocalTestCase::testVBOPermissions in Translation Management Tool 7

Test permissions for the tmgmt_local VBO actions.

File

translators/tmgmt_local/tmgmt_local.test, line 585
Test cases for the local translator module.

Class

TMGMTLocalTestCase
Basic tests for the local translator.

Code

function testVBOPermissions() {
  $translator = tmgmt_translator_load('local');
  $job = $this
    ->createJob();
  $job->translator = $translator->name;
  $job->settings['job_comment'] = $job_comment = 'Dummy job comment';
  $job
    ->addItem('test_source', 'test', '1');
  $job
    ->addItem('test_source', 'test', '2');

  // Create another local translator with the required capabilities.
  $local_translator = $this
    ->loginAsTranslator($this->local_translator_permissions);

  // Configure language capabilities.
  $edit = array(
    'tmgmt_translation_skills[und][0][language_from]' => 'en',
    'tmgmt_translation_skills[und][0][language_to]' => 'de',
  );
  $this
    ->drupalPost('user/' . $local_translator->uid . '/edit', $edit, t('Save'));
  $job
    ->requestTranslation();
  $this
    ->drupalGet('translate');
  $this
    ->assertFieldById('edit-rules-componentrules-tmgmt-local-task-assign-to-me', t('Assign to me'));
  $this
    ->assertFieldById('edit-rules-componentrules-tmgmt-local-task-unassign', t('Unassign'));

  // Login as admin and check VBO submit actions are present.
  $this
    ->loginAsAdmin(array(
    'administer translation tasks',
  ));
  $this
    ->drupalGet('manage-translate');
  $this
    ->assertFieldById('edit-actionviews-bulk-operations-argument-selector-action--2', t('Assign to...'));
  $this
    ->assertFieldById('edit-actionviews-bulk-operations-argument-selector-action', t('Reassign to...'));
}