You are here

public function BundleInheritTestCase::testInherit in Bundle Inherit 7

Create new content type. Strictly inherit it from content type created in setUp().

File

bundle_inherit_node/bundle_inherit_node.test, line 51
Tests for bundle_inherit_node module.

Class

BundleInheritTestCase
@file Tests for bundle_inherit_node module.

Code

public function testInherit() {
  $edit = array(
    'name' => $this->childTypeName,
    'type' => $this->childTypeName,
    'bundle_inherit[inherit]' => TRUE,
    'bundle_inherit[parent_type]' => $this->parentType->type,
    'bundle_inherit[mode]' => 'strict',
  );
  $this
    ->drupalPost('admin/structure/types/add', $edit, t('Save content type'));
  $type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(
    ':type' => $this->childTypeName,
  ))
    ->fetchField();
  $this
    ->assertTrue($type_exists, t('Type was created.'));
  $type_inherited = db_query('SELECT 1 FROM {bundle_inherit} WHERE entity_type = :entity_type AND bundle = :bundle AND bundle_parent = :bundle_parent', array(
    ':entity_type' => 'node',
    ':bundle' => $this->childTypeName,
    ':bundle_parent' => $this->parentType->type,
  ))
    ->fetchField();
  $this
    ->assertTrue($type_inherited, t('Type was inherited.'));
}