You are here

function ContentAccessTestCase::createNode in Content Access 5

Creates a node for testing purposes

Return value

the node object

3 calls to ContentAccessTestCase::createNode()
ContentAccessACLTestCase::setUp in tests/content_access_acl.test
Setup configuration before each test
ContentAccessModuleTestCase::setUp in tests/content_access.test
Preparation work that is done before each test. Test users, content types, nodes etc. are created.
ContentAccessModuleTestCase::testDeleteAccess in tests/content_access.test
Test for deleting nodes

File

tests/content_access_test_help.php, line 58
Helper class with auxiliary functions for content access module tests

Class

ContentAccessTestCase
@file Helper class with auxiliary functions for content access module tests

Code

function createNode() {
  $title = $this
    ->randomName(10);
  $edit = array(
    'title' => $title,
    'body' => $this
      ->randomName(20),
  );
  $this
    ->drupalPostRequest('node/add/' . $this->url_content_type_name, $edit, 'Submit');
  $this
    ->assertWantedRaw(t('Your %content has been created.', array(
    '%content' => $this->content_type_name,
  )), 'Test node was added successfully');
  return node_load(array(
    'title' => $title,
    'type' => $this->content_type_name,
  ));
}