function UserpointsNodeCommentTestCase::verifyPublishing in User points Nodes and Comments 7
Create a published node, unpublish and publish it again.
1 call to UserpointsNodeCommentTestCase::verifyPublishing()
File
- ./
userpoints_nc.test, line 100 - Tests for userpoints_nc.module
Class
- UserpointsNodeCommentTestCase
- @file Tests for userpoints_nc.module
Code
function verifyPublishing() {
$content = array(
'title' => $this
->randomName(10),
);
$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'],
)));
$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);
$this
->clickLink(t('Edit'));
$edit_content = array(
'status' => FALSE,
);
$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 had 5 points deducted and now have 0 points in the General category.'));
// 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);
}