Commit c90e9f91 authored by Dries's avatar Dries
Browse files

- Patch #585742 by Damien Tournoud | Amitaibu: content type wasn't created...

- Patch #585742 by Damien Tournoud | Amitaibu: content type wasn't created after drupalCreateContentType().
parent f15438cc
......@@ -840,6 +840,23 @@ class NodeTypeTestCase extends DrupalWebTestCase {
$this->assertEqual($node_types['article']->name, node_type_get_name('article'), t('Correct node type name has been returned.'));
$this->assertEqual($node_types['page']->base, node_type_get_base('page'), t('Correct node type base has been returned.'));
}
/**
* Test creating a content type.
*/
function testNodeTypeCreation() {
$type = $this->drupalCreateContentType();
$type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $type->type))->fetchField();
$this->assertTrue($type_exists, 'The new content type has been created in the database.');
// Login a test user.
$web_user = $this->drupalCreateUser(array('create ' . $type->name . ' content'));
$this->drupalLogin($web_user);
$this->drupalGet('node/add/' . str_replace('_', '-', $type->name));
$this->assertResponse(200, 'The new content type can be accessed at node/add.');
}
}
/**
......
......@@ -762,6 +762,7 @@ protected function drupalCreateContentType($settings = array()) {
$defaults = array(
'type' => $name,
'name' => $name,
'base' => 'node_content',
'description' => '',
'help' => '',
'title_label' => 'Title',
......@@ -783,6 +784,7 @@ protected function drupalCreateContentType($settings = array()) {
$saved_type = node_type_save($type);
node_types_rebuild();
menu_rebuild();
$this->assertEqual($saved_type, SAVED_NEW, t('Created content type %type.', array('%type' => $type->type)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment