<?php

/**
 * @file
 * Tests for the Workflow Named Transitions module.
 */

class WorkflowNamedTransitionsTest extends DrupalWebTestCase {
  function getInfo() {
    return array(
      'name' => 'Workflow Named Transitions Test',
      'description' => "This tests whether the Edit Labels tab exists in the workflow area.",
      'group' => 'Workflow',
    );
  }

  function setUp() {
    parent::setUp('workflow', 'workflow_named_transitions');
  }

  function testEditLabelsExistsAdmin() {
    $user = $this->drupalCreateUser(array('administer workflow'));
    $this->drupalLogin($user);
    $this->drupalGet('admin/build/workflow');
    // HTML of the Edit labels tab.
    $this->assertRaw(sprintf('admin/build/workflow/labels">%s</a>', t('Edit labels')), t('Edit labels tab found'));
    $this->drupalGet('admin/build/workflow/labels');
    $this->assertResponse('200');
  }

  function testEditLabelsMissing() {
    $user = $this->drupalCreateUser(array('access content'));
    $this->drupalLogin($user);
    $this->drupalGet('admin/build/workflow');
    // HTML of the Edit labels tab
    $this->assertNoRaw(sprintf('admin/build/workflow/labels">%s</a>', t('Edit labels')), t('Edit labels tab not found'));
    $this->drupalGet('admin/build/workflow/labels');
    $this->assertResponse('403');
  }

  function tearDown() {
    parent::tearDown();
  }
}
