node.test 21.3 KB
Newer Older
1 2 3
<?php
// $Id$

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
/**
 * Test the node_load_multiple() function.
 */
class NodeLoadMultipleUnitTest extends DrupalWebTestCase {

  function getInfo() {
    return array(
      'name' => t('Load multiple nodes'),
      'description' => t('Test the loading of multiple nodes.'),
      'group' => t('Node'),
    );
  }

  function setUp() {
    parent::setUp();
    $web_user = $this->drupalCreateUser(array('create article content', 'create page content'));
    $this->drupalLogin($web_user);
  }

  /**
   * Create four nodes and ensure they're loaded correctly.
   */
  function testNodeMultipleLoad() {
    $node1 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
    $node2 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
    $node3 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 0));
    $node4 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 0));

    // Confirm that promoted nodes appear in the default node listing.
    $this->drupalGet('node');
    $this->assertText($node1->title, t('Node title appears on the default listing.'));
    $this->assertText($node2->title, t('Node title appears on the default listing.'));
    $this->assertNoText($node3->title, t('Node title does not appear in the default listing.'));
    $this->assertNoText($node4->title, t('Node title does not appear in the default listing.'));

    // Load nodes with only a condition. Nodes 3 and 4 will be loaded.
    $nodes = node_load_multiple(NULL, array('promote' => 0));
    $this->assertEqual($node3->title, $nodes[$node3->nid]->title, t('Node was loaded.'));
    $this->assertEqual($node4->title, $nodes[$node4->nid]->title, t('Node was loaded.'));
    $count = count($nodes);
    $this->assertTrue($count == 2, t('@count nodes loaded.', array('@count' => $count)));

    // Load nodes by nid. Nodes 1, 2 and 4 will be loaded.
    $nodes = node_load_multiple(array(1, 2, 4));
    $count = count($nodes);
    $this->assertTrue(count($nodes) == 3, t('@count nodes loaded', array('@count' => $count)));
    $this->assertTrue(isset($nodes[$node1->nid]), t('Node is correctly keyed in the array'));
    $this->assertTrue(isset($nodes[$node2->nid]), t('Node is correctly keyed in the array'));
    $this->assertTrue(isset($nodes[$node4->nid]), t('Node is correctly keyed in the array'));
    foreach ($nodes as $node) {
      $this->assertTrue(is_object($node), t('Node is an object'));
    }

    // Load nodes by nid, where type = article. Nodes 1, 2 and 3 will be loaded.
    $nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
    $count = count($nodes);
    $this->assertTrue($count == 3, t('@count nodes loaded', array('@count' => $count)));
    $this->assertEqual($nodes[$node1->nid]->title, $node1->title, t('Node successfully loaded.'));
    $this->assertEqual($nodes[$node2->nid]->title, $node2->title, t('Node successfully loaded.'));
    $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded.'));
    $this->assertFalse(isset($nodes[$node4->nid]));

    // Now that all nodes have been loaded into the static cache, ensure that
    // they are loaded correctly again when a condition is passed.
    $nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
    $count = count($nodes);
    $this->assertTrue($count == 3, t('@count nodes loaded.', array('@count' => $count)));
    $this->assertEqual($nodes[$node1->nid]->title, $node1->title, t('Node successfully loaded'));
    $this->assertEqual($nodes[$node2->nid]->title, $node2->title, t('Node successfully loaded'));
    $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded'));
    $this->assertFalse(isset($nodes[$node4->nid]), t('Node was not loaded'));

    // Load nodes by nid, where type = article and promote = 0.
    $nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article', 'promote' => 0));
    $count = count($nodes);
    $this->assertTrue($count == 1, t('@count node loaded', array('@count' => $count)));
    $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded.'));
  }
}

84
class NodeRevisionsTestCase extends DrupalWebTestCase {
85 86 87
  protected $nodes;
  protected $logs;

88 89 90
  function getInfo() {
    return array(
      'name' => t('Node revisions'),
91 92
      'description' => t('Create a node with revisions and test viewing, reverting, and deleting revisions.'),
      'group' => t('Node'),
93 94 95
    );
  }

96 97
  function setUp() {
    parent::setUp();
98

99
    // Create and login user.
100
    $web_user = $this->drupalCreateUser(array('view revisions', 'revert revisions', 'edit any page content',
101
                                               'delete revisions', 'delete any page content'));
102
    $this->drupalLogin($web_user);
103

104 105 106 107
    // Create initial node.
    $node = $this->drupalCreateNode();
    $settings = get_object_vars($node);
    $settings['revision'] = 1;
108

109 110
    $nodes = array();
    $logs = array();
111

112 113
    // Get original node.
    $nodes[] = $node;
114

115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
    // Create three revisions.
    $revision_count = 3;
    for ($i = 0; $i < $revision_count; $i++) {
      $logs[] = $settings['log'] = $this->randomName(32);

      // Create revision with random title and body and update variables.
      $this->drupalCreateNode($settings);
      $node = node_load($node->nid); // Make sure we get revision information.
      $settings = get_object_vars($node);

      $nodes[] = $node;
    }

    $this->nodes = $nodes;
    $this->logs = $logs;
130 131 132
  }

  /**
133
   * Check node revision related operations.
134
   */
135 136 137
  function testRevisions() {
    $nodes = $this->nodes;
    $logs = $this->logs;
138

139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
    // Get last node for simple checks.
    $node = $nodes[3];

    // Confirm the correct revision text appears on "view revisions" page.
    $this->drupalGet("node/$node->nid/revisions/$node->vid/view");
    $this->assertText($node->body, t('Correct text displays for version.'));

    // Confirm the correct log message appears on "revisions overview" page.
    $this->drupalGet("node/$node->nid/revisions");
    foreach ($logs as $log) {
      $this->assertText($log, t('Log message found.'));
    }

    // Confirm that revisions revert properly.
    $this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/revert", array(), t('Revert'));
    $this->assertRaw(t('@type %title has been reverted back to the revision from %revision-date.',
                        array('@type' => 'Page', '%title' => $nodes[1]->title,
                              '%revision-date' => format_date($nodes[1]->revision_timestamp))), t('Revision reverted.'));
    $reverted_node = node_load($node->nid);
    $this->assertTrue(($nodes[1]->body == $reverted_node->body), t('Node reverted correctly.'));

    // Confirm revisions delete properly.
    $this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/delete", array(), t('Delete'));
    $this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
                        array('%revision-date' => format_date($nodes[1]->revision_timestamp),
                              '@type' => 'Page', '%title' => $nodes[1]->title)), t('Revision deleted.'));
165
    $this->assertTrue(db_result(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = %d and vid = %d', $node->nid, $nodes[1]->vid)) == 0, t('Revision not found.'));
166 167 168 169 170 171 172
  }
}

class NodeTeaserTestCase extends DrupalWebTestCase {
  function getInfo() {
    return array(
      'name' => t('Node teaser'),
173 174
      'description' => t('Test node_teaser() with different strings and lengths.'),
      'group' => t('Node'),
175 176 177 178
    );
  }

  /**
179
   * Tests an edge case where if the first sentence is a question and
180 181
   * subsequent sentences are not. This is edge case is documented at
   * http://drupal.org/node/180425.
182 183 184
   */
  function testFirstSentenceQuestion() {
    $body = 'A question? A sentence. Another sentence.';
185 186
    $expected = 'A question? A sentence.';
    $this->callNodeTeaser($body, $expected, NULL, 30);
187 188 189
  }

  /**
190
   * Test teaser with long example.
191
   */
192 193 194 195 196 197 198 199 200 201
  function testLongSentence() {
    $body = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ' . // 125
            'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ' . // 108
            'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' . // 103
            'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'; // 110
    $expected = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ' .
                'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ' .
                'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.';
    // First three sentences add up to: 336, so add one for space and then 3 to get half-way into next word.
    $this->callNodeTeaser($body, $expected, NULL, 340);
202 203 204
  }

  /**
205
   * Test various teaser length edge cases.
206 207 208 209 210 211 212
   */
  function testLength() {
    // This body string tests a number of edge cases.
    $body = "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>";

    // The teasers we expect node_teaser() to return when $size is the index
    // of each array item.
213
    // Using an text format with no line-break filter:
214
    $teasers = array(
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
      "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>",
      "<",
      "<p",
      "<p>",
      "<p>\n",
      "<p>\nH",
      "<p>\nHi",
      "<p>\nHi\n",
      "<p>\nHi\n<",
      "<p>\nHi\n</",
      "<p>\nHi\n</p",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>",
      "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>",
      "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>",
    );

255
    // And Using an text format WITH the line-break filter.
256
    $teasers_lb = array(
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
      "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>",
      "<",
      "<p",
      "<p>",
      "<p>",
      "<p>",
      "<p>",
      "<p>\nHi",
      "<p>\nHi",
      "<p>\nHi",
      "<p>\nHi",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>",
      "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>",
      "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>",
      "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>",
    );
296 297 298 299 300 301 302 303 304 305 306 307

    // Test node_teaser() for different sizes.
    for ($i = 0; $i <= 37; $i++) {
      $this->callNodeTeaser($body, $teasers[$i],    NULL, $i);
      $this->callNodeTeaser($body, $teasers_lb[$i], 1,    $i);
      $this->callNodeTeaser($body, $teasers_lb[$i], 2,    $i);
    }
  }

  /**
   * Calls node_teaser() and asserts that the expected teaser is returned.
   */
308
  function callNodeTeaser($body, $expected, $format = NULL, $size = NULL) {
309
    $teaser = node_teaser($body, $format, $size);
310
    $this->assertIdentical($teaser, $expected, t('Generated teaser "@teaser" matches expected teaser.', array('@teaser' => $teaser)));
311 312 313 314 315 316
  }
}

class PageEditTestCase extends DrupalWebTestCase {
  function getInfo() {
    return array(
317 318 319 320
      'name' => t('Node edit'),
      'description' => t('Create a node and test node edit functionality.'),
      'group' => t('Node'),
    );
321 322
  }

323 324 325
  function setUp() {
    parent::setUp();

326 327
    $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content'));
    $this->drupalLogin($web_user);
328
  }
329

330 331 332 333 334 335 336 337
  /**
   * Check node edit functionality.
   */
  function testPageEdit() {
    // Create node to edit.
    $edit = array();
    $edit['title'] = $this->randomName(8);
    $edit['body'] = $this->randomName(16);
338 339
    $this->drupalPost('node/add/page', $edit, t('Save'));

340
    // Check that the node exists in the database.
341
    $node = $this->drupalGetNodeByTitle($edit['title']);
342
    $this->assertTrue($node, t('Node found in database.'));
343

344
    // Check that "edit" link points to correct page.
345
    $this->clickLink(t('Edit'));
346 347 348
    $edit_url = url("node/$node->nid/edit", array('absolute' => true));
    $actual_url = $this->getURL();
    $this->assertEqual($edit_url, $actual_url, t('On edit page.'));
349

350 351 352 353
    // Check that the title and body fields are displayed with the correct values.
    $this->assertLink(t('Edit'), 0, t('Edit tab found.'));
    $this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
    $this->assertFieldByName('body', '<!--break-->' . $edit['body'], t('Body field displayed.'));
354

355 356 357 358 359 360 361 362 363 364
    // Edit the content of the node.
    $edit = array();
    $edit['title'] = $this->randomName(8);
    $edit['body'] = $this->randomName(16);
    // Stay on the current page, without reloading.
    $this->drupalPost(NULL, $edit, t('Save'));

    // Check that the title and body fields are displayed with the updated values.
    $this->assertText($edit['title'], t('Title displayed.'));
    $this->assertText($edit['body'], t('Body displayed.'));
365 366 367 368 369 370
  }
}

class PagePreviewTestCase extends DrupalWebTestCase {
  function getInfo() {
    return array(
371 372 373 374
      'name' => t('Node preview'),
      'description' => t('Test node preview functionality.'),
      'group' => t('Node'),
    );
375 376
  }

377 378 379
  function setUp() {
    parent::setUp();

380 381
    $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content'));
    $this->drupalLogin($web_user);
382
  }
383

384 385 386 387 388 389 390 391
  /**
   * Check the node preview functionality.
   */
  function testPagePreview() {
    // Fill in node creation form and preview node.
    $edit = array();
    $edit['title'] = $this->randomName(8);
    $edit['body'] = $this->randomName(16);
392 393
    $this->drupalPost('node/add/page', $edit, t('Preview'));

394
    // Check that the preview is displaying the title and body.
395
    $this->assertTitle(t('Preview | Drupal'), t('Page title is preview.'));
396 397
    $this->assertText($edit['title'], t('Title displayed.'));
    $this->assertText($edit['body'], t('Body displayed.'));
398

399 400 401
    // Check that the title and body fields are displayed with the correct values.
    $this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
    $this->assertFieldByName('body', '<!--break-->' . $edit['body'], t('Body field displayed.'));
402 403 404
  }
}

405
class PageCreationTestCase extends DrupalWebTestCase {
406 407
  function getInfo() {
    return array(
408 409
      'name' => t('Node creation'),
      'description' => t('Create a node and test saving it.'),
410 411 412 413
      'group' => t('Node'),
    );
  }

414 415
  function setUp() {
    parent::setUp();
416

417
    $web_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
418
    $this->drupalLogin($web_user);
419
  }
420

421 422 423 424 425
  /**
   * Create a page node and verify its consistency in the database.
   */
  function testPageCreation() {
    // Create a node.
426
    $edit = array();
427 428
    $edit['title'] = $this->randomName(8);
    $edit['body'] = $this->randomName(16);
429 430
    $this->drupalPost('node/add/page', $edit, t('Save'));

431 432
    // Check that the page has been created.
    $this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit['title'])), t('Page created.'));
433

434
    // Check that the node exists in the database.
435
    $node = $this->drupalGetNodeByTitle($edit['title']);
436
    $this->assertTrue($node, t('Node found in database.'));
437 438 439 440 441 442
  }
}

class PageViewTestCase extends DrupalWebTestCase {
  function getInfo() {
    return array(
443 444
      'name' => t('Node edit permissions'),
      'description' => t('Create a node and test edit permissions.'),
445 446
      'group' => t('Node'),
    );
447 448
  }

449 450 451
  /**
   * Creates a node and then an anonymous and unpermissioned user attempt to edit the node.
   */
452
  function testPageView() {
453
    // Create a node to view.
454
    $node = $this->drupalCreateNode();
455
    $this->assertTrue(node_load($node->nid), t('Node created.'));
456

457
    // Try to edit with anonymous user.
458 459 460
    $html = $this->drupalGet("node/$node->nid/edit");
    $this->assertResponse(403);

461 462 463
    // Create a user without permission to edit node.
    $web_user = $this->drupalCreateUser(array('access content'));
    $this->drupalLogin($web_user);
464

465 466
    // Attempt to access edit page.
    $this->drupalGet("node/$node->nid/edit");
467 468
    $this->assertResponse(403);

469
    // Create user with permission to edit node.
470
    $web_user = $this->drupalCreateUser(array('bypass node access'));
471 472 473 474 475
    $this->drupalLogin($web_user);

    // Attempt to access edit page.
    $this->drupalGet("node/$node->nid/edit");
    $this->assertResponse(200);
476 477
  }
}
478 479 480 481

class NodeTitleXSSTestCase extends DrupalWebTestCase {
  function getInfo() {
     return array(
482 483
      'name' => t('Node title XSS filtering'),
      'description' => t('Create a node with dangerous tags in its title and test that they are escaped.'),
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
      'group' => t('Node'),
    );
  }

  function testNodeTitleXSS() {
    // Prepare a user to do the stuff.
    $web_user = $this->drupalCreateUser(array('create page content', 'edit any page content'));
    $this->drupalLogin($web_user);

    $xss = '<script>alert("xss")</script>';

    $edit = array(
      'title' => $xss . $this->randomName(),
    );
    $this->drupalPost('node/add/page', $edit, t('Preview'));
    $this->assertNoRaw($xss, t('Harmful tags are escaped when previewing a node.'));

    $node = $this->drupalCreateNode($edit);

    $this->drupalGet('node/' . $node->nid);
    $this->assertNoRaw($xss, t('Harmful tags are escaped when viewing a node.'));

    $this->drupalGet('node/' . $node->nid . '/edit');
    $this->assertNoRaw($xss, t('Harmful tags are escaped when editing a node.'));
  }
509
}
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539

class NodeBlockTestCase extends DrupalWebTestCase {
  function getInfo() {
    return array(
      'name' => t('Block availability'),
      'description' => t('Check if the syndicate block is available.'),
      'group' => t('Node'),
    );
  }

  function setUp() {
    parent::setUp();

    // Create and login user
    $admin_user = $this->drupalCreateUser(array('administer blocks'));
    $this->drupalLogin($admin_user);
  }

  function testSearchFormBlock() {
    // Set block title to confirm that the interface is availble.
    $this->drupalPost('admin/build/block/configure/node/syndicate', array('title' => $this->randomName(8)), t('Save block'));
    $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));

    // Set the block to a region to confirm block is availble.
    $edit = array();
    $edit['node_syndicate[region]'] = 'footer';
    $this->drupalPost('admin/build/block', $edit, t('Save blocks'));
    $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
  }
}
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601

/**
 * Check that the post information displays when enabled for a content type.
 */
class NodePostSettingsTestCase extends DrupalWebTestCase {
  function getInfo() {
    return array(
      'name' => t('Node post information display'),
      'description' => t('Check that the post information (submitted by Username on date) text displays appropriately.'),
      'group' => t('Node'),
    );
  }

  function setUp() {
    parent::setUp();

    $web_user = $this->drupalCreateUser(array('create page content', 'administer content types', 'access user profiles'));
    $this->drupalLogin($web_user);
  }

  /**
   * Set page content type to display post information and confirm its presence on a new node.
   */
  function testPagePostInfo() {

    // Set page content type to display post information.
    $edit = array();
    $edit['node_submitted'] = TRUE;
    $this->drupalPost('admin/build/node-type/page', $edit, t('Save content type'));

    // Create a node.
    $edit = array();
    $edit['title'] = $this->randomName(8);
    $edit['body'] = $this->randomName(16);
    $this->drupalPost('node/add/page', $edit, t('Save'));

    // Check that the post information is displayed.
    $node = $this->drupalGetNodeByTitle($edit['title']);
    $this->assertRaw(theme('node_submitted', $node), t('Post information is displayed.'));
  }

  /**
   * Set page content type to not display post information and confirm its absence on a new node.
   */
  function testPageNotPostInfo() {

    // Set page content type to display post information.
    $edit = array();
    $edit['node_submitted'] = FALSE;
    $this->drupalPost('admin/build/node-type/page', $edit, t('Save content type'));

    // Create a node.
    $edit = array();
    $edit['title'] = $this->randomName(8);
    $edit['body'] = $this->randomName(16);
    $this->drupalPost('node/add/page', $edit, t('Save'));

    // Check that the post information is displayed.
    $node = $this->drupalGetNodeByTitle($edit['title']);
    $this->assertNoRaw(theme('node_submitted', $node), t('Post information is not displayed.'));
  }
}