You are here

protected function FeaturesUserTestCase::_test_node in Features 7.2

Same name and namespace in other branches
  1. 6 tests/features.test \FeaturesUserTestCase::_test_node()
  2. 7 tests/features.test \FeaturesUserTestCase::_test_node()

Loads or saves an example node type for testing.

Parameters

string $op: One of 'load' or 'override'.

Return value

\stdClass|false|void If $op === 'load': The 'features_test' node type, or FALSE if it does not exist. If $op === 'override': No return value (null/void). The 'features_test' node type will be modified, the description will be changed to 'Foo bar baz.'.

Throws

\Exception In node_type_save().

File

tests/features.test, line 217
Contains test classes for features module.

Class

FeaturesUserTestCase
User permission component tests for Features.

Code

protected function _test_node($op = 'load') {
  switch ($op) {
    case 'load':
      return node_type_get_type('features_test');
    case 'override':
      $type = node_type_get_type('features_test');
      $type->description = 'Foo bar baz.';
      $type->modified = TRUE;
      node_type_save($type);
      break;
  }
}