Révision cf490feb
Ajouté par Assos Assos il y a environ 6 ans
drupal7/modules/simpletest/tests/common.test | ||
---|---|---|
76 | 76 |
class CommonURLUnitTest extends DrupalWebTestCase { |
77 | 77 |
public static function getInfo() { |
78 | 78 |
return array( |
79 |
'name' => 'URL generation tests', |
|
79 |
'name' => 'URL generation unit tests',
|
|
80 | 80 |
'description' => 'Confirm that url(), drupal_get_query_parameters(), drupal_http_build_query(), and l() work correctly with various input.', |
81 | 81 |
'group' => 'System', |
82 | 82 |
); |
... | ... | |
372 | 372 |
} |
373 | 373 |
} |
374 | 374 |
|
375 |
/** |
|
376 |
* Web tests for URL generation functions. |
|
377 |
*/ |
|
378 |
class CommonURLWebTest extends DrupalWebTestCase { |
|
379 |
public static function getInfo() { |
|
380 |
return array( |
|
381 |
'name' => 'URL generation web tests', |
|
382 |
'description' => 'Confirm that URL-generating functions work correctly on specific site paths.', |
|
383 |
'group' => 'System', |
|
384 |
); |
|
385 |
} |
|
386 |
|
|
387 |
function setUp() { |
|
388 |
parent::setUp('common_test'); |
|
389 |
} |
|
390 |
|
|
391 |
/** |
|
392 |
* Tests the url() function on internal paths which mimic external URLs. |
|
393 |
*/ |
|
394 |
function testInternalPathMimicsExternal() { |
|
395 |
// Ensure that calling url(current_path()) on "/http://example.com" (an |
|
396 |
// internal path which mimics an external URL) always links to the internal |
|
397 |
// path, not the external URL. This helps protect against external URL link |
|
398 |
// injection vulnerabilities. |
|
399 |
variable_set('common_test_link_to_current_path', TRUE); |
|
400 |
$this->drupalGet('/http://example.com'); |
|
401 |
$this->clickLink('link which should point to the current path'); |
|
402 |
$this->assertUrl('/http://example.com'); |
|
403 |
$this->assertText('link which should point to the current path'); |
|
404 |
} |
|
405 |
} |
|
406 |
|
|
375 | 407 |
/** |
376 | 408 |
* Tests url_is_external(). |
377 | 409 |
*/ |
Formats disponibles : Unified diff
Update to 7.57