summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries Buytaert2009-09-25 15:12:56 (GMT)
committerDries Buytaert2009-09-25 15:12:56 (GMT)
commitc90e9f9109d7b7d7abccde5684b0cab87c1a9d18 (patch)
treeb8d3801ed4f0a7b4564f41b8ae813908b5d071c3
parentf15438cc9af8cae43bc976b36d64c314dc917a94 (diff)
- Patch #585742 by Damien Tournoud | Amitaibu: content type wasn't created after drupalCreateContentType().
-rw-r--r--modules/node/node.test17
-rw-r--r--modules/simpletest/drupal_web_test_case.php2
2 files changed, 19 insertions, 0 deletions
diff --git a/modules/node/node.test b/modules/node/node.test
index 0de3355..a48782b 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -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.');
+ }
}
/**
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 80495ed..455a121 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -762,6 +762,7 @@ class DrupalWebTestCase extends DrupalTestCase {
$defaults = array(
'type' => $name,
'name' => $name,
+ 'base' => 'node_content',
'description' => '',
'help' => '',
'title_label' => 'Title',
@@ -783,6 +784,7 @@ class DrupalWebTestCase extends DrupalTestCase {
$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)));