You are here

function OgTestCase::addNodeType in Organic groups 5.2

Same name and namespace in other branches
  1. 5.8 tests/og_testcase.php \OgTestCase::addNodeType()
  2. 5 tests/og_testcase.php \OgTestCase::addNodeType()
  3. 5.3 tests/og_testcase.php \OgTestCase::addNodeType()
  4. 5.7 tests/og_testcase.php \OgTestCase::addNodeType()
2 calls to OgTestCase::addNodeType()
OgPost::testOgPost in tests/og_post.test
OgSubscribe::testAddOg in tests/og_subscribe.test

File

tests/og_testcase.php, line 26

Class

OgTestCase

Code

function addNodeType() {
  $type = new stdClass();
  $name = strtolower($this
    ->randomName());
  $type->type = trim($name);
  $type->name = trim($name);
  $type->orig_type = trim("");
  $type->old_type = $type->type;
  $type->description = $this
    ->randomName(32, "description ... ");
  $type->help = $type->description = $this
    ->randomName(32, "help ... ");
  $type->min_word_count = 0;
  $type->title_label = "Title";
  $type->body_label = "Body";
  $type->module = 'node';
  $type->has_title = $type->has_body = TRUE;
  $type->custom = "";
  $type->modified = TRUE;
  $type->locked = TRUE;
  $status = node_type_save($type);
  $this
    ->assertTrue(SAVED_NEW == $status, "Created node-type {$name}.");
  $this->_cleanupNodeTypes[] = $name;
  $types = variable_get('og_node_types', array());
  $types[$name] = $name;
  variable_set('og_node_types', $types);
  return $name;
}