Index: token.tokens.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.tokens.inc,v
retrieving revision 1.27
diff -u -p -r1.27 token.tokens.inc
--- token.tokens.inc	13 Nov 2010 19:12:45 -0000	1.27
+++ token.tokens.inc	13 Nov 2010 21:22:41 -0000
@@ -22,10 +22,10 @@ function token_token_info_alter(&$info) 
   // Add a 'dynamic' key to any tokens that have chained but dynamic tokens.
   $info['tokens']['date']['custom']['dynamic'] = TRUE;
 
-  // @todo Remove [node:tnid] now that we have [node:source:nid]?
-  //unset($info['tokens']['node']['tnid']);
-
-  // @todo Change [node:type-name] to [node:machine-name]?
+  // Remove deprecated tokens from being listed.
+  unset($info['tokens']['node']['tnid']);
+  unset($info['tokens']['node']['type']);
+  unset($info['tokens']['node']['type-name']);
 
   // Add [token:path] tokens for any URI-able entities.
   $entities = entity_get_info();
@@ -59,6 +59,30 @@ function token_token_info() {
     'name' => t('Revision log message'),
     'description' => t('The explanation of the most recent changes made to the node.'),
   );
+  $info['tokens']['node']['content-type'] = array(
+    'name' => t('Content type'),
+    'description' => t('The content type of the node.'),
+    'type' => 'content-type',
+  );
+
+  // Content type tokens.
+  $info['types']['content-type'] = array(
+    'name' => t('Content type'),
+    'description' => t('Tokens related to content types.'),
+    'needs-data' => 'content-type',
+  );
+  $info['tokens']['content-type']['name'] = array(
+    'name' => t('Name'),
+    'description' => t('The name of the content type.'),
+  );
+  $info['tokens']['content-type']['machine-name'] = array(
+    'name' => t('Machine-readable name'),
+    'description' => t('The unique machine-readable name of the content type.'),
+  );
+  $info['tokens']['content-type']['description'] = array(
+    'name' => t('Description'),
+    'description' => t('The optional description of the content type.'),
+  );
 
   // Taxonomy term and vocabulary tokens.
   if (module_exists('taxonomy')) {
@@ -199,6 +223,10 @@ function token_tokens($type, $tokens, ar
         case 'log':
           $replacements[$original] = $sanitize ? filter_xss($node->log) : $node->log;
           break;
+        case 'content-type':
+          $type_name = node_type_get_name($node);
+          $replacements[$original] = $sanitize ? check_plain($type_name) : $type_name;
+          break;
       }
     }
 
@@ -206,6 +234,28 @@ function token_tokens($type, $tokens, ar
     if (!empty($node->tnid) && ($source_tokens = token_find_with_prefix($tokens, 'source')) && $source_node = node_load($node->tnid)) {
       $replacements += token_generate('node', $source_tokens, array('node' => $source_node), $options);
     }
+    if (($node_type_tokens = token_find_with_prefix($tokens, 'content-type')) && $node_type = node_type_load($node->type)) {
+      $replacements += token_generate('content-type', $node_type_tokens, array('node_type' => $node_type), $options);
+    }
+  }
+
+  // Content type tokens.
+  if ($type == 'content-type' && !empty($data['node_type'])) {
+    $node_type = $data['node_type'];
+
+    foreach ($tokens as $name => $original) {
+      switch ($name) {
+        case 'name':
+          $replacements[$original] = $sanitize ? check_plain($node_type->name) : $node_type->name;
+          break;
+        case 'machine-name':
+          $replacements[$original] = $node_type->type;
+          break;
+        case 'description':
+          $replacements[$original] = $sanitize ? filter_xss($node_type->description) : $node_type->description;
+          break;
+      }
+    }
   }
 
   // Taxonomy term tokens.
Index: token.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.test,v
retrieving revision 1.20
diff -u -p -r1.20 token.test
--- token.test	13 Nov 2010 19:12:45 -0000	1.20
+++ token.test	13 Nov 2010 21:22:41 -0000
@@ -24,7 +24,12 @@ class TokenTestHelper extends DrupalWebT
     $token_input = drupal_map_assoc(array_keys($tokens));
     $values = token_generate($type, $token_input, array($type => $object), $options);
     foreach ($tokens as $token => $expected) {
-      $this->assertIdentical($values[$token], $expected, t("Token value for [@type:@token] was '@actual', expected value '@expected'.", array('@type' => $type, '@token' => $token, '@actual' => $values[$token], '@expected' => $expected)));
+      if (isset($expected)) {
+        $this->assertIdentical($values[$token], $expected, t("Token value for [@type:@token] was '@actual', expected value '@expected'.", array('@type' => $type, '@token' => $token, '@actual' => $values[$token], '@expected' => $expected)));
+      }
+      else {
+        $this->assertTrue(!isset($values[$token]), t("Token value for [@type:@token] was not generated.", array('@type' => $type, '@token' => $token)));
+      }
     }
   }
 
@@ -101,28 +106,46 @@ class TokenUnitTestCase extends TokenTes
 class TokenNodeTestCase extends TokenTestHelper {
   public static function getInfo() {
     return array(
-      'name' => 'Node token tests',
-      'description' => 'Test the node tokens.',
+      'name' => 'Node and content type token tests',
+      'description' => 'Test the node and content type tokens.',
       'group' => 'Token',
     );
   }
 
   function testNodeTokens() {
     $source_node = $this->drupalCreateNode(array('log' => $this->randomName(), 'path' => array('alias' => 'content/source-node')));
-    $translated_node = $this->drupalCreateNode(array('tnid' => $source_node->nid));
+    $tokens = array(
+      'source' => NULL,
+      'source:nid' => NULL,
+      'log' => $source_node->log,
+      'path' => 'content/source-node',
+      'content-type' => 'Basic page',
+      'content-type:name' => 'Basic page',
+      'content-type:machine-name' => 'page',
+      'content-type:description' => "Use <em>basic pages</em> for your static content, such as an 'About us' page.",
+      // Deprecated tokens.
+      'tnid' => 0,
+      'type' => 'page',
+      'type-name' => 'Basic page',
+    );
+    $this->assertTokens('node', $source_node, $tokens);
 
-    // Test [node:source] tokens.
-    $this->assertToken('node', $translated_node, 'source', $source_node->title);
-    $this->assertToken('node', $translated_node, 'source:nid', $source_node->nid);
-    //$this->assertToken('node', $source_node, 'source', '', array('clear' => TRUE));
-
-    // Test [node:log] token.
-    $this->assertToken('node', $source_node, 'log', $source_node->log);
-    $this->assertToken('node', $translated_node, 'log', '');
-
-    // Test [node:path] token.
-    $this->assertToken('node', $source_node, 'path', 'content/source-node');
-    $this->assertToken('node', $translated_node, 'path', 'node/' . $translated_node->nid);
+    $translated_node = $this->drupalCreateNode(array('tnid' => $source_node->nid, 'type' => 'article'));
+    $tokens = array(
+      'source' => $source_node->title,
+      'source:nid' => $source_node->nid,
+      'log' => '',
+      'path' => "node/{$translated_node->nid}",
+      'content-type' => 'Article',
+      'content-type:name' => 'Article',
+      'content-type:machine-name' => 'article',
+      'content-type:description' => "Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.",
+      // Deprecated tokens.
+      'type' => 'article',
+      'type-name' => 'Article',
+      'tnid' => $source_node->nid,
+    );
+    $this->assertTokens('node', $translated_node, $tokens);
   }
 }
 
@@ -171,6 +194,20 @@ class TokenMenuTestCase extends TokenTes
     );
     $this->assertTokens('node', $node, $tokens);
   }
+
+  function testMenuItemAccess() {
+    variable_set('menu_options_page', array('main-menu', 'management'));
+    // Fetch the mlid of the administer
+    $admin_mlid = db_query("SELECT mlid FROM {menu_links} WHERE menu_name = 'management' AND link_path = 'admin'")->fetchField();
+    $node_link = array(
+      'enabled' => TRUE,
+      'link_title' => 'Admin node link',
+      'plid' => $admin_mlid,
+      'customized' => 0,
+      'description' => '',
+    );
+    $node = $this->drupalCreateNode(array('menu' => $node_link));
+  }
 }
 
 class TokenTaxonomyTestCase extends TokenTestHelper {
@@ -360,11 +397,11 @@ class TokenProfileTestCase extends Token
     $account = user_load($this->account->uid, TRUE);
 
     // The checkbox and select profile tokens should no longer return a value.
-    $no_tokens = array(
-      'profile-checkbox',
-      'profile-selection',
+    $tokens = array(
+      'profile-checkbox' => NULL,
+      'profile-selection' => NULL,
     );
-    $this->assertNoTokens('user', $account, $no_tokens);
+    $this->assertTokens('user', $account, $tokens);
   }
 
   /**
