Révision 134c7813
Ajouté par Mathieu Schiano Di Schiabica il y a environ 8 ans
drupal7/modules/system/system.test | ||
---|---|---|
1350 | 1350 |
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.'); |
1351 | 1351 |
$this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.'); |
1352 | 1352 |
|
1353 |
// Check that ajax callback is protected by CSRF token. |
|
1354 |
$this->drupalGet('admin/config/regional/date-time/formats/lookup', array('query' => array('format' => 'Y m d'))); |
|
1355 |
$this->assertResponse(403, 'Access denied with no token'); |
|
1356 |
$this->drupalGet('admin/config/regional/date-time/formats/lookup', array('query' => array('token' => 'invalid', 'format' => 'Y m d'))); |
|
1357 |
$this->assertResponse(403, 'Access denied with invalid token'); |
|
1358 |
$this->drupalGet('admin/config/regional/date-time/formats'); |
|
1359 |
$this->clickLink(t('edit')); |
|
1360 |
$settings = $this->drupalGetSettings(); |
|
1361 |
$lookup_url = $settings['dateTime']['date-format']['lookup']; |
|
1362 |
preg_match('/token=([^&]+)/', $lookup_url, $matches); |
|
1363 |
$this->assertFalse(empty($matches[1]), 'Found token value'); |
|
1364 |
$this->drupalGet('admin/config/regional/date-time/formats/lookup', array('query' => array('token' => $matches[1], 'format' => 'Y m d'))); |
|
1365 |
$this->assertResponse(200, 'Access allowed with valid token'); |
|
1366 |
$this->assertText(format_date(time(), 'custom', 'Y m d')); |
|
1367 |
|
|
1353 | 1368 |
// Delete custom date format. |
1369 |
$this->drupalGet('admin/config/regional/date-time/formats'); |
|
1354 | 1370 |
$this->clickLink(t('delete')); |
1355 | 1371 |
$this->drupalPost($this->getUrl(), array(), t('Remove')); |
1356 | 1372 |
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.'); |
Formats disponibles : Unified diff
Update to 7.43