diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-05-01 08:12:23 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-05-01 08:12:23 +0000 |
commit | 71713081a2b79b0baa024742cdbb4af536f77f4b (patch) | |
tree | e9bc0d309856beb05a6fae67fdbdd75c59ccef9f /modules/simpletest/tests | |
parent | 2a2f4cc0be547f515ccd4212e9aeca7765a4968b (diff) | |
download | brdo-71713081a2b79b0baa024742cdbb4af536f77f4b.tar.gz brdo-71713081a2b79b0baa024742cdbb4af536f77f4b.tar.bz2 |
- Patch #723802 by pwolanin, grendzy: convert to sha-256 and hmac from md5 and sha1.
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r-- | modules/simpletest/tests/actions.test | 6 | ||||
-rw-r--r-- | modules/simpletest/tests/registry.test | 24 |
2 files changed, 16 insertions, 14 deletions
diff --git a/modules/simpletest/tests/actions.test b/modules/simpletest/tests/actions.test index eaf86e47b..e88021f64 100644 --- a/modules/simpletest/tests/actions.test +++ b/modules/simpletest/tests/actions.test @@ -21,7 +21,7 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase { // Make a POST request to admin/config/system/actions/manage. $edit = array(); - $edit['action'] = md5('system_goto_action'); + $edit['action'] = drupal_hash_base64('system_goto_action'); $this->drupalPost('admin/config/system/actions/manage', $edit, t('Create')); // Make a POST request to the individual action configuration page. @@ -29,7 +29,7 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase { $action_label = $this->randomName(); $edit['actions_label'] = $action_label; $edit['url'] = 'admin'; - $this->drupalPost('admin/config/system/actions/configure/' . md5('system_goto_action'), $edit, t('Save')); + $this->drupalPost('admin/config/system/actions/configure/' . drupal_hash_base64('system_goto_action'), $edit, t('Save')); // Make sure that the new complex action was saved properly. $this->assertText(t('The action has been successfully saved.'), t("Make sure we get a confirmation that we've successfully saved the complex action.")); @@ -87,7 +87,7 @@ class ActionLoopTestCase extends DrupalWebTestCase { $user = $this->drupalCreateUser(array('administer actions')); $this->drupalLogin($user); - $hash = md5('actions_loop_test_log'); + $hash = drupal_hash_base64('actions_loop_test_log'); $edit = array('aid' => $hash); $this->drupalPost('admin/structure/trigger/actions_loop_test', $edit, t('Assign')); diff --git a/modules/simpletest/tests/registry.test b/modules/simpletest/tests/registry.test index 09464922c..81bcfd8ef 100644 --- a/modules/simpletest/tests/registry.test +++ b/modules/simpletest/tests/registry.test @@ -11,9 +11,10 @@ class RegistryParseFileTestCase extends DrupalWebTestCase { } function setUp() { - $this->fileName = 'registry_test_' . md5(rand()); - $this->className = 'registry_test_class' . md5(rand()); - $this->interfaceName = 'registry_test_interface' . md5(rand()); + $chrs = hash('sha256', microtime() . mt_rand()); + $this->fileName = 'registry_test_' . substr($chrs, 0, 16); + $this->className = 'registry_test_class' . substr($chrs, 16, 16); + $this->interfaceName = 'registry_test_interface' . substr($chrs, 32, 16); parent::setUp(); } @@ -61,18 +62,19 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase { // Create files with some php to parse - one 'new', one 'existing' so // we test all the important code paths in _registry_parse_files. foreach ($this->fileTypes as $fileType) { + $chrs = hash('sha256', microtime() . mt_rand()); $this->$fileType = new stdClass(); - $this->$fileType->fileName = file_directory_path() . '/registry_test_' . md5(rand()); - $this->$fileType->className = 'registry_test_class' . md5(rand()); - $this->$fileType->interfaceName = 'registry_test_interface' . md5(rand()); + $this->$fileType->fileName = file_directory_path() . '/registry_test_' . substr($chrs, 0, 16); + $this->$fileType->className = 'registry_test_class' . substr($chrs, 16, 16); + $this->$fileType->interfaceName = 'registry_test_interface' . substr($chrs, 32, 16); $this->$fileType->contents = $this->getFileContents($fileType); file_save_data($this->$fileType->contents, $this->$fileType->fileName); if ($fileType == 'existing_changed') { db_insert('registry_file') ->fields(array( - 'filectime' => rand(1, 1000000), - 'filemtime' => rand(1, 1000000), + 'filectime' => mt_rand(1, 1000000), + 'filemtime' => mt_rand(1, 1000000), 'filename' => $this->$fileType->fileName, )) ->execute(); @@ -81,7 +83,7 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase { foreach (array('class', 'interface') as $type) { db_insert('registry') ->fields(array( - 'name' => $type . md5(rand()), + 'name' => $type . hash('sha256', microtime() . mt_rand()), 'type' => $type, 'filename' => $this->$fileType->fileName, )) @@ -117,8 +119,8 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase { foreach ($this->fileTypes as $fileType) { $files[$this->$fileType->fileName] = array('module' => '', 'weight' => 0); if ($fileType == 'existing_changed') { - $files[$this->$fileType->fileName]['filectime'] = rand(1, 1000000); - $files[$this->$fileType->fileName]['filemtime'] = rand(1, 1000000); + $files[$this->$fileType->fileName]['filectime'] = mt_rand(1, 1000000); + $files[$this->$fileType->fileName]['filemtime'] = mt_rand(1, 1000000); } } return $files; |