You are here

function UserpointsNodeCommentTestCase::testCreateContent in User points Nodes and Comments 7

File

./userpoints_nc.test, line 34
Tests for userpoints_nc.module

Class

UserpointsNodeCommentTestCase
@file Tests for userpoints_nc.module

Code

function testCreateContent() {
  $this->admin = $this
    ->drupalCreateUser(array(
    'view userpoints',
    'view own userpoints',
    'bypass node access',
    'administer nodes',
    'administer userpoints',
    'administer content types',
  ));
  $this->user = $this
    ->drupalCreateUser(array(
    'view own userpoints',
  ));
  $this
    ->drupalLogin($this->admin);
  $this->type = array(
    'name' => $this
      ->randomName(10),
    'type' => strtolower($this
      ->randomName(5)),
    'userpoints_nc_points' => 5,
  );
  $this
    ->drupalPost('admin/structure/types/add', $this->type, t('Save content type'));
  $this
    ->assertText(t('The content type @name has been added.', array(
    '@name' => $this->type['name'],
  )));
  node_types_rebuild();
  menu_rebuild();

  // Reset permissions so that permissions for this content type are available.
  $this
    ->checkPermissions(array(), TRUE);
  user_role_grant_permissions(4, array(
    'create ' . $this->type['type'] . ' content',
    'edit any ' . $this->type['type'] . ' content',
  ));
  $this
    ->verifyPublishing();
  $this
    ->deletePoints();
  $this
    ->verifyPublishingAuthorChange();
  $this
    ->deletePoints();
  $this
    ->verifyUnpublished();
}