You are here

jammer_preview.test in Jammer 5

File

tests/jammer_preview.test
View source
<?php

class JammerPreviewButtonTest extends DrupalTestCase {
  function get_info() {
    return array(
      'name' => 'Jammer Preview Browser Test',
      'desc' => "This tests whether the preview button exists and then is properly removed",
      'group' => 'Jammer',
    );
  }
  function testNoPreviewButtonNoContentAccess() {
    $user = $this
      ->drupalCreateUserRolePerm(array(
      'access content',
    ));
    $this
      ->drupalLoginUser($user);
    $this
      ->drupalModuleEnable('jammer');
    $this
      ->drupalVariableSet('jammer_preview_button_unset_node_types', array(
      'page',
    ));
    $url = url('node/add/page', NULL, NULL, TRUE);
    $this
      ->get($url);
    $this
      ->assertNoUnwantedRaw('id="edit-preview"');
  }
  function testNoPreviewButtonWithContentCreation() {
    $user = $this
      ->drupalCreateUserRolePerm(array(
      'create page content',
    ));
    $this
      ->drupalLoginUser($user);
    $this
      ->drupalModuleEnable('jammer');
    $this
      ->drupalVariableSet('jammer_preview_button_unset_node_types', array(
      'page',
    ));
    $url = url('node/add/page', NULL, NULL, TRUE);
    $this
      ->get($url);
    $this
      ->assertNoUnwantedRaw('id="edit-preview"');
  }
  function testPreviewButton() {
    $user = $this
      ->drupalCreateUserRolePerm(array(
      'create page content',
    ));
    $this
      ->drupalLoginUser($user);
    $this
      ->drupalModuleDisable('jammer');
    $this
      ->drupalVariableSet('jammer_preview_button_unset_node_types', array());
    $url = url('node/add/page', NULL, NULL, TRUE);
    $this
      ->get($url);
    $this
      ->assertWantedRaw('id="edit-preview"');
  }

}

Classes