Index: modules/node/node.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.test,v
retrieving revision 1.4
diff -u -r1.4 node.test
--- modules/node/node.test	26 Jun 2008 11:40:07 -0000	1.4
+++ modules/node/node.test	15 Aug 2008 12:50:50 -0000
@@ -96,7 +96,7 @@
 
 class NodeTeaserTestCase extends DrupalWebTestCase {
   /**
-   * Implementation of getInfo() for information
+   * Implementation of getInfo().
    */
   function getInfo() {
     return array(
@@ -106,14 +106,6 @@
     );
   }
 
-  function setUp() {
-    parent::setUp();
-  }
-
-  function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    * Tests an edge case where if the first sentence is a question and
    * subsequent sentences are not.
@@ -257,36 +249,35 @@
     $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content'));
     $this->drupalLogin($web_user);
     $edit = array(
-    'title' => '!SimpleTest! test title' . $this->randomName(20),
-    'body' => '!SimpleTest! test body' . $this->randomName(200),
-  );
+      'title' => $this->randomName(10, 'node_title_'),
+      'body' => $this->randomName(50, 'node_body_'),
+    );
 
-    //Create the page to edit
+    // Create the page to edit.
     $this->drupalPost('node/add/page', $edit, t('Save'));
 
     $node = node_load(array('title' => $edit['title']));
-    $this->assertNotNull($node, 'Node found in database');
+    $this->assertNotNull($node, t('Node found in database.'));
 
     $this->clickLink(t('Edit'));
     $editurl = url("node/$node->nid/edit", array('absolute' => true));
-    $acturl = $this->getURL();
-    $this->assertEqual($editurl, $acturl);
+    $actual_url = $this->getURL();
+    $this->assertEqual($editurl, $actual_url);
 
-    $this->assertText(t('Edit'), 'Edit text is here');
-    $this->assertText(t($edit['title']), 'Hello, the random title');
-    $this->assertText(t($edit['body']), 'test is over, the body\'s still there');
+    $this->assertText(t('Edit'), t('Edit tab is selected.'));
+    $this->assertText($edit['title'], t('Node title is present on edit page.'));
+    $this->assertText($edit['body'], t('Node body is present on edit page.'));
 
     $edit = array(
-    'title' => '!SimpleTest! test title' . $this->randomName(20),
-    'body' => '!SimpleTest! test body' . $this->randomName(200),
-  );
-
+      'title' => $this->randomName(10, 'node_title_'),
+      'body' => $this->randomName(50, 'node_body_'),
+    );
 
-    //edit the content of the page
+    // Edit the content of the page.
     $this->drupalPost("node/$node->nid/edit", $edit, t('Save'));
 
-    $this->assertText(t($edit['title']), 'Hello, the random title');
-    $this->assertText(t($edit['body']), 'test is over, the body\'s still there');
+    $this->assertText($edit['title'], t('Edited node title has been saved.'));
+    $this->assertText($edit['body'], t('Edited node body has been saved.'));
   }
 
 }
@@ -314,8 +305,8 @@
     $this->drupalLogin($web_user);
 
     $edit = array(
-      'title'=>'!SimpleTest! title' . $this->randomName(20),
-      'body'=>'!SimpleTest! body' . $this->randomName(200),
+      'title' => $this->randomName(10, 'node_title_'),
+      'body' => $this->randomName(50, 'node_body_'),
     );
     $this->drupalPost('node/add/page', $edit, t('Preview'));
 
@@ -330,7 +321,8 @@
 }
 
 class PageCreationTestCase extends  DrupalWebTestCase {
-
+  protected $content_type;
+  
   /**
    * Implementation of getInfo().
    */
@@ -341,25 +333,31 @@
       'group' => t('Node'),
     );
   }
+  
+  function setUp() {
+    parent::setUp();
+    
+    // Create a user to do the stuff.
+    $test_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
+    $this->drupalLogin($test_user);
+    
+    $this->content_type = $this->drupalCreateContentType();
+  }
 
   function testPageCreation() {
-    // Prepare settings.
-    variable_set('node_options_page', array('status', 'promote'));
-
-    // Prepare a user to do the stuff.
-    $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content'));
-    $this->drupalLogin($web_user);
-
-    $edit = array();
-    $edit['title']    = '!SimpleTest test node! ' . $this->randomName(10);
-    $edit['body']     = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
+    // Create a page.
+    $edit = array(
+      'title' => $this->randomName(10, 'title_'),
+      'body' => $this->randomName(50, 'body_'),
+    );
     $this->drupalPost('node/add/page', $edit, t('Save'));
 
+    // Check that the page has been created.
     $this->assertRaw(t('!post %title has been created.', array ('!post' => 'Page', '%title' => $edit['title'])), 'Page created');
 
+    // Check that the page exists in the database.
     $node = node_load(array('title' => $edit['title']));
     $this->assertNotNull($node, t('Node !title found in database.', array ('!title' => $edit['title'])));
-
   }
 }
 
@@ -374,20 +372,20 @@
         . 'before tries with an anonymous user. Asserts failure.'
         . '</ br>WARNING: This is based on default registered user permissions (no administer nodes).')
       , 'group' => t('Node'),
-  );
+    );
   }
 
   function testPageView() {
-    // Prepare a node to view
+    // Prepare a node to view.
     global $user;
     $node = $this->drupalCreateNode();
-    $this->assertNotNull(node_load($node->nid), 'Node created');
+    $this->assertNotNull(node_load($node->nid), t('Node created'));
 
-    // Tries to edit with anonymous user
+    // Tries to edit with anonymous user.
     $html = $this->drupalGet("node/$node->nid/edit");
     $this->assertResponse(403);
 
-    // Prepare a user to request the node view
+    // Prepare a user to request the node view.
     $test_user = $this->drupalCreateUser(array('access content'));
     $this->drupalLogin($test_user);
 
@@ -395,6 +393,7 @@
     $this->assertResponse(403);
 
     $test_user = $this->drupalCreateUser(array('administer nodes'));
+    
     //TODO: Add edit page attempt with administer nodes user
     node_delete($node->nid);
   }
