You are here

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

Create a node that is initially unpublished.

1 call to UserpointsNodeCommentTestCase::verifyUnpublished()
UserpointsNodeCommentTestCase::testCreateContent in ./userpoints_nc.test

File

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

Class

UserpointsNodeCommentTestCase
@file Tests for userpoints_nc.module

Code

function verifyUnpublished() {
  $content = array(
    'title' => $this
      ->randomName(10),
    'status' => FALSE,
  );
  $this
    ->drupalPost('node/add/' . $this->type['type'], $content, t('Save'));
  $this
    ->assertText(t('@name @title has been created.', array(
    '@name' => $this->type['name'],
    '@title' => $content['title'],
  )));

  // Verify point total.
  $this
    ->assertEqual(userpoints_get_current_points($this->admin->uid), 0);
  $this
    ->clickLink(t('Edit'));
  $edit_content = array(
    'status' => TRUE,
  );
  $this
    ->drupalPost(NULL, $edit_content, t('Save'));
  $this
    ->assertText(t('@name @title has been updated.', array(
    '@name' => $this->type['name'],
    '@title' => $content['title'],
  )));
  $this
    ->assertText(t('You just earned 5 points and now have 5 points in the General category.'));

  // Verify point total.
  $this
    ->assertEqual(userpoints_get_current_points($this->admin->uid), 5);
}