Révision 7547bb19
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/modules/captcha/captcha.test | ||
---|---|---|
60 | 60 |
|
61 | 61 |
function setUp() { |
62 | 62 |
// Load two modules: the captcha module itself and the comment module for testing anonymous comments. |
63 |
parent::setUp('captcha', 'comment'); |
|
63 |
$modules = func_get_args(); |
|
64 |
if (isset($modules[0]) && is_array($modules[0])) { |
|
65 |
$modules = $modules[0]; |
|
66 |
} |
|
67 |
parent::setUp(array_merge(array('captcha', 'comment'), $modules)); |
|
64 | 68 |
module_load_include('inc', 'captcha'); |
65 | 69 |
|
66 | 70 |
// Create a normal user. |
... | ... | |
602 | 606 |
// Set CAPTCHA on user register form. |
603 | 607 |
captcha_set_form_id_setting('user_register', 'captcha/Math'); |
604 | 608 |
|
605 |
// Put Javascript snippet in CAPTCHA description.
|
|
609 |
// Put JavaScript snippet in CAPTCHA description.
|
|
606 | 610 |
$this->drupalLogin($this->admin_user); |
607 | 611 |
$xss = '<script type="text/javascript">alert("xss")</script>'; |
608 | 612 |
$edit = array('captcha_description' => $xss); |
609 | 613 |
$this->drupalPost(self::CAPTCHA_ADMIN_PATH, $edit, 'Save configuration'); |
610 | 614 |
|
611 |
// Visit user register form and check if Javascript snippet is there.
|
|
615 |
// Visit user register form and check if JavaScript snippet is there.
|
|
612 | 616 |
$this->drupalLogout(); |
613 | 617 |
$this->drupalGet('user/register'); |
614 |
$this->assertNoRaw($xss, 'Javascript should not be allowed in CAPTCHA description.', 'CAPTCHA');
|
|
618 |
$this->assertNoRaw($xss, 'JavaScript should not be allowed in CAPTCHA description.', 'CAPTCHA');
|
|
615 | 619 |
|
616 | 620 |
} |
617 | 621 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules