You are here

function NodeTypeTestCase::testNodeTypeGetFunctions in Drupal 7

Ensures that node type functions (node_type_get_*) work correctly.

Load available node types and validate the returned data.

File

modules/node/node.test, line 1473
Tests for node.module.

Class

NodeTypeTestCase
Tests related to node types.

Code

function testNodeTypeGetFunctions() {
  $node_types = node_type_get_types();
  $node_names = node_type_get_names();
  $this
    ->assertTrue(isset($node_types['article']), 'Node type article is available.');
  $this
    ->assertTrue(isset($node_types['page']), 'Node type basic page is available.');
  $this
    ->assertEqual($node_types['article']->name, $node_names['article'], 'Correct node type base has been returned.');
  $this
    ->assertEqual($node_types['article'], node_type_get_type('article'), 'Correct node type has been returned.');
  $this
    ->assertEqual($node_types['article']->name, node_type_get_name('article'), 'Correct node type name has been returned.');
  $this
    ->assertEqual($node_types['page']->base, node_type_get_base('page'), 'Correct node type base has been returned.');
}