Révision b0dc3a2e
Ajouté par Julien Enselme il y a plus de 7 ans
drupal7/modules/system/system.test | ||
---|---|---|
726 | 726 |
|
727 | 727 |
// Block a valid IP address. |
728 | 728 |
$edit = array(); |
729 |
$edit['ip'] = '192.168.1.1';
|
|
729 |
$edit['ip'] = '1.2.3.3';
|
|
730 | 730 |
$this->drupalPost('admin/config/people/ip-blocking', $edit, t('Add')); |
731 | 731 |
$ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField(); |
732 | 732 |
$this->assertTrue($ip, t('IP address found in database.')); |
... | ... | |
734 | 734 |
|
735 | 735 |
// Try to block an IP address that's already blocked. |
736 | 736 |
$edit = array(); |
737 |
$edit['ip'] = '192.168.1.1';
|
|
737 |
$edit['ip'] = '1.2.3.3';
|
|
738 | 738 |
$this->drupalPost('admin/config/people/ip-blocking', $edit, t('Add')); |
739 | 739 |
$this->assertText(t('This IP address is already blocked.')); |
740 | 740 |
|
... | ... | |
770 | 770 |
// $this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save')); |
771 | 771 |
// $this->assertText(t('You may not block your own IP address.')); |
772 | 772 |
} |
773 |
|
|
774 |
/** |
|
775 |
* Test duplicate IP addresses are not present in the 'blocked_ips' table. |
|
776 |
*/ |
|
777 |
function testDuplicateIpAddress() { |
|
778 |
drupal_static_reset('ip_address'); |
|
779 |
$submit_ip = $_SERVER['REMOTE_ADDR'] = '192.168.1.1'; |
|
780 |
system_block_ip_action(); |
|
781 |
system_block_ip_action(); |
|
782 |
$ip_count = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $submit_ip))->rowCount(); |
|
783 |
$this->assertEqual('1', $ip_count); |
|
784 |
drupal_static_reset('ip_address'); |
|
785 |
$submit_ip = $_SERVER['REMOTE_ADDR'] = ' '; |
|
786 |
system_block_ip_action(); |
|
787 |
system_block_ip_action(); |
|
788 |
system_block_ip_action(); |
|
789 |
$ip_count = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $submit_ip))->rowCount(); |
|
790 |
$this->assertEqual('1', $ip_count); |
|
791 |
} |
|
773 | 792 |
} |
774 | 793 |
|
775 | 794 |
class CronRunTestCase extends DrupalWebTestCase { |
... | ... | |
2354 | 2373 |
$this->update_user = $this->drupalCreateUser(array('administer software updates')); |
2355 | 2374 |
} |
2356 | 2375 |
|
2376 |
/** |
|
2377 |
* Tests that there are no pending updates for the first test method. |
|
2378 |
*/ |
|
2379 |
function testNoPendingUpdates() { |
|
2380 |
// Ensure that for the first test method in a class, there are no pending |
|
2381 |
// updates. This tests a drupal_get_schema_versions() bug that previously |
|
2382 |
// led to the wrong schema version being recorded for the initial install |
|
2383 |
// of a child site during automated testing. |
|
2384 |
$this->drupalLogin($this->update_user); |
|
2385 |
$this->drupalGet($this->update_url, array('external' => TRUE)); |
|
2386 |
$this->drupalPost(NULL, array(), t('Continue')); |
|
2387 |
$this->assertText(t('No pending updates.'), 'End of update process was reached.'); |
|
2388 |
} |
|
2389 |
|
|
2357 | 2390 |
/** |
2358 | 2391 |
* Tests access to the update script. |
2359 | 2392 |
*/ |
... | ... | |
2435 | 2468 |
$this->assertText('This is a requirements error provided by the update_script_test module.'); |
2436 | 2469 |
$this->clickLink('try again'); |
2437 | 2470 |
$this->assertText('This is a requirements error provided by the update_script_test module.'); |
2471 |
|
|
2472 |
// Check if the optional 'value' key displays without a notice. |
|
2473 |
variable_set('update_script_test_requirement_type', REQUIREMENT_INFO); |
|
2474 |
$this->drupalGet($this->update_url, array('external' => TRUE)); |
|
2475 |
$this->assertText('This is a requirements info provided by the update_script_test module.'); |
|
2476 |
$this->assertNoText('Notice: Undefined index: value in theme_status_report()'); |
|
2438 | 2477 |
} |
2439 | 2478 |
|
2440 | 2479 |
/** |
Formats disponibles : Unified diff
Update to Drupal 7.52