You are here

function PageCreationTest::testPageCreation in SimpleTest 5

Same name and namespace in other branches
  1. 6 tests/page_creation.test \PageCreationTest::testPageCreation()

File

tests/page_creation.test, line 17

Class

PageCreationTest

Code

function testPageCreation() {

  /* Prepare settings */
  $this
    ->drupalVariableSet('node_options_page', array(
    'status',
    'promote',
  ));

  /* Prepare a user to do the stuff */
  $web_user = $this
    ->drupalCreateUserRolePerm(array(
    'edit own page content',
    'create page content',
  ));
  $this
    ->drupalLoginUser($web_user);
  $edit = array();
  $edit['title'] = '!SimpleTest test node! ' . $this
    ->randomName(10);
  $edit['body'] = '!SimpleTest test body! ' . $this
    ->randomName(32) . ' ' . $this
    ->randomName(32);
  $this
    ->drupalPostRequest('node/add/page', $edit, 'Submit');
  $this
    ->assertWantedRaw(t('Your %post has been created.', array(
    '%post' => 'Page',
  )), 'Page created');
  $node = node_load(array(
    'title' => $edit['title'],
  ));
  $this
    ->assertNotNull($node, 'Node found in database. %s');
}