Projet

Général

Profil

Révision bceb9b7a

Ajouté par Florent Torregrosa il y a environ 9 ans

Update core to 7.35

Voir les différences:

drupal7/modules/system/system.test
2825 2825
    return TRUE;
2826 2826
  }
2827 2827
}
2828

  
2829
/**
2830
 * Tests confirm form destinations.
2831
 */
2832
class ConfirmFormTest extends DrupalWebTestCase {
2833
  protected $admin_user;
2834

  
2835
  public static function getInfo() {
2836
    return array(
2837
      'name' => 'Confirm form',
2838
      'description' => 'Tests that the confirm form does not use external destinations.',
2839
      'group' => 'System',
2840
    );
2841
  }
2842

  
2843
  function setUp() {
2844
    parent::setUp();
2845

  
2846
    $this->admin_user = $this->drupalCreateUser(array('administer users'));
2847
    $this->drupalLogin($this->admin_user);
2848
  }
2849

  
2850
  /**
2851
   * Tests that the confirm form does not use external destinations.
2852
   */
2853
  function testConfirmForm() {
2854
    $this->drupalGet('user/1/cancel');
2855
    $this->assertCancelLinkUrl(url('user/1'));
2856
    $this->drupalGet('user/1/cancel', array('query' => array('destination' => 'node')));
2857
    $this->assertCancelLinkUrl(url('node'));
2858
    $this->drupalGet('user/1/cancel', array('query' => array('destination' => 'http://example.com')));
2859
    $this->assertCancelLinkUrl(url('user/1'));
2860
  }
2861

  
2862
  /**
2863
   * Asserts that a cancel link is present pointing to the provided URL.
2864
   */
2865
  function assertCancelLinkUrl($url, $message = '', $group = 'Other') {
2866
    $links = $this->xpath('//a[normalize-space(text())=:label and @href=:url]', array(':label' => t('Cancel'), ':url' => $url));
2867
    $message = ($message ? $message : format_string('Cancel link with url %url found.', array('%url' => $url)));
2868
    return $this->assertTrue(isset($links[0]), $message, $group);
2869
  }
2870
}

Formats disponibles : Unified diff