Projet

Général

Profil

Révision 4444412d

Ajouté par Julien Enselme il y a environ 10 ans

Update drupal 7.27 -> 7.28

Voir les différences:

drupal7/modules/node/node.test
571 571
    );
572 572

  
573 573
    try {
574
      // An exception is generated by node_test_exception_node_insert() if the
575
      // title is 'testing_transaction_exception'.
574 576
      node_save((object) $edit);
575 577
      $this->fail(t('Expected exception has not been thrown.'));
576 578
    }
......
1374 1376
   * @see node_test_node_insert()
1375 1377
   */
1376 1378
  function testNodeSaveOnInsert() {
1377
    // node_test_node_insert() tiggers a save on insert if the title equals
1379
    // node_test_node_insert() triggers a save on insert if the title equals
1378 1380
    // 'new'.
1379 1381
    $node = $this->drupalCreateNode(array('title' => 'new'));
1380 1382
    $this->assertEqual($node->title, 'Node ' . $node->nid, 'Node saved on node insert.');
......
2442 2444
      $output = token_replace($input, array('node' => $node), array('language' => $language, 'sanitize' => FALSE));
2443 2445
      $this->assertEqual($output, $expected, format_string('Unsanitized node token %token replaced.', array('%token' => $input)));
2444 2446
    }
2447

  
2448
    // Repeat for a node without a summary.
2449
    $settings['body'] = array(LANGUAGE_NONE => array(array('value' => $this->randomName(32), 'summary' => '')));
2450
    $node = $this->drupalCreateNode($settings);
2451

  
2452
    // Load node (without summary) so that the body and summary fields are
2453
    // structured properly.
2454
    $node = node_load($node->nid);
2455
    $instance = field_info_instance('node', 'body', $node->type);
2456

  
2457
    // Generate and test sanitized token - use full body as expected value.
2458
    $tests = array();
2459
    $tests['[node:summary]'] = _text_sanitize($instance, $langcode, $node->body[$langcode][0], 'value');
2460

  
2461
    // Test to make sure that we generated something for each token.
2462
    $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated for node without a summary.');
2463

  
2464
    foreach ($tests as $input => $expected) {
2465
      $output = token_replace($input, array('node' => $node), array('language' => $language));
2466
      $this->assertEqual($output, $expected, format_string('Sanitized node token %token replaced for node without a summary.', array('%token' => $input)));
2467
    }
2468

  
2469
    // Generate and test unsanitized tokens.
2470
    $tests['[node:summary]'] = $node->body[$langcode][0]['value'];
2471

  
2472
    foreach ($tests as $input => $expected) {
2473
      $output = token_replace($input, array('node' => $node), array('language' => $language, 'sanitize' => FALSE));
2474
      $this->assertEqual($output, $expected, format_string('Unsanitized node token %token replaced for node without a summary.', array('%token' => $input)));
2475
    }
2445 2476
  }
2446 2477
}
2447 2478

  

Formats disponibles : Unified diff