Projet

Général

Profil

Révision 582db59d

Ajouté par Assos Assos il y a plus de 8 ans

Update Drupal core to version 7.40

Voir les différences:

drupal7/modules/image/image.test
77 77
    return field_create_instance($instance);
78 78
  }
79 79

  
80
  /**
81
   * Create a random style.
82
   *
83
   * @return array
84
   *  A list containing the details of the generated image style.
85
   */
86
  function createRandomStyle() {
87
    $style_name = strtolower($this->randomName(10));
88
    $style_label = $this->randomString();
89
    image_style_save(array('name' => $style_name, 'label' => $style_label));
90
    $style_path = 'admin/config/media/image-styles/edit/' . $style_name;
91
    return array(
92
      'name' => $style_name,
93
      'label' => $style_label,
94
      'path' => $style_path,
95
    );
96
  }
97

  
80 98
  /**
81 99
   * Upload an image to a node.
82 100
   *
......
469 487
  }
470 488
}
471 489

  
490
/**
491
 * Tests the administrative user interface.
492
 */
493
class ImageAdminUiTestCase extends ImageFieldTestCase {
494
  public static function getInfo() {
495
    return array(
496
      'name' => 'Administrative user interface',
497
      'description' => 'Tests the forms used in the administrative user interface.',
498
      'group' => 'Image',
499
    );
500
  }
501

  
502
  function setUp() {
503
    parent::setUp(array('image'));
504
  }
505

  
506
  /**
507
   * Test if the help text is available on the add effect form.
508
   */
509
  function testAddEffectHelpText() {
510
    // Create a random image style.
511
    $style = $this->createRandomStyle();
512

  
513
    // Open the add effect form and check for the help text.
514
    $this->drupalGet($style['path'] . '/add/image_crop');
515
    $this->assertText(t('Cropping will remove portions of an image to make it the specified dimensions.'), 'The image style effect help text was displayed on the add effect page.');
516
  }
517

  
518
  /**
519
   * Test if the help text is available on the edit effect form.
520
   */
521
  function testEditEffectHelpText() {
522
    // Create a random image style.
523
    $random_style = $this->createRandomStyle();
524

  
525
    // Add the crop effect to the image style.
526
    $edit = array();
527
    $edit['data[width]'] = 20;
528
    $edit['data[height]'] = 20;
529
    $this->drupalPost($random_style['path'] . '/add/image_crop', $edit, t('Add effect'));
530

  
531
    // Open the edit effect form and check for the help text.
532
    drupal_static_reset('image_styles');
533
    $style = image_style_load($random_style['name']);
534

  
535
    foreach ($style['effects'] as $ieid => $effect) {
536
      $this->drupalGet($random_style['path'] . '/effects/' . $ieid);
537
      $this->assertText(t('Cropping will remove portions of an image to make it the specified dimensions.'), 'The image style effect help text was displayed on the edit effect page.');
538
    }
539
  }
540
}
541

  
472 542
/**
473 543
 * Tests creation, deletion, and editing of image styles and effects.
474 544
 */

Formats disponibles : Unified diff