From 04d407900a909f900cbe70bdd70e48ecd86dfc47 Mon Sep 17 00:00:00 2001
From: Bob Vincent <bobvin@pillars.net>
Date: Sun, 13 Mar 2011 08:37:09 -0400
Subject: [PATCH] Add tests fordeleting a node type.

---
 modules/node/node.test |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/modules/node/node.test b/modules/node/node.test
index 8a871c0..32edfdd 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -1145,14 +1145,25 @@ class NodeTypeTestCase extends DrupalWebTestCase {
   /**
    * Test creating a content type programmatically and via a form.
    */
-  function testNodeTypeCreation() {
-    // Create a content type programmaticaly.
+  function testNodeTypeCreateDelete() {
+    // Create and delete a content type programmaticaly.
     $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.');
+    node_type_delete($type->name);
+    $type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $type->type))->fetchField();
+    $this->assertFalse($type_exists, 'The new content type has been deleted from the database.');
+
+    // Create, disable and delete a content type programmaticaly.
+    // Disabling a content type simulates disabling a module which creates the content type
+    $type = $this->drupalCreateContentType();
+    db_query("UPDATE {node_type} SET disabled = TRUE WHERE type = :type", array(':type' => $type->type));
+    node_type_delete($type->name);
+    $type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $type->type))->fetchField();
+    $this->assertFalse($type_exists, 'A disabled content type has been deleted from the database.');
 
     // Login a test user.
+    $type = $this->drupalCreateContentType();
     $web_user = $this->drupalCreateUser(array('create ' . $type->name . ' content'));
     $this->drupalLogin($web_user);
 
-- 
1.7.1

