? fix_user_register_test
? fix_user_register_test.profile
? simpletest_cleanup.patch
Index: simpletest.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/simpletest.module,v
retrieving revision 1.29
diff -u -p -r1.29 simpletest.module
--- simpletest.module	29 Nov 2007 10:17:51 -0000	1.29
+++ simpletest.module	24 Dec 2007 19:03:48 -0000
@@ -2,24 +2,6 @@
 // $Id: simpletest.module,v 1.29 2007/11/29 10:17:51 rokZlender Exp $
 
 /**
- * Implementation of hook_help().
- */
-function simpletest_help($section) {
-  $output = '';
-
-  switch ($section) {
-    case 'admin/modules#description':
-      $output = t("Simple unit testing suite");
-      break;
-    case 'admin/settings/simpletest':
-      $output = '';
-      break;
-  }
-
-  return $output;
-}
-
-/**
  * Implementation of hook_menu().
  */
 function simpletest_menu() {
@@ -57,63 +39,48 @@ function simpletest_load() {
   }
   global $user;
   if ($user->uid != 1) {
-    drupal_set_message(t('We strongly suggest running the simpletests with uid=1!'));
+    drupal_set_message(t('It is strongly suggested to run the tests with the first user!'));
   }
-  
   $loaded = true;
   if (!defined('SIMPLE_TEST')) {
-    define('SIMPLE_TEST', drupal_get_path('module', 'simpletest'). '/simpletest'); 
-  } 
-  if (!is_dir(SIMPLE_TEST)){
-    $output = t('Sorry but the simpletest cannot be found in the current installation. Please notice that simpletest.module needs Simpletest framework. '
-              . 'Please download it from !simpletest_link and place it into the same directory as simpletest.module: %simpletest_directory',
-                array('!simpletest_link' => l('Simpletest on SourceForge', 'https://sourceforge.net/project/showfiles.php?group_id=76550'),
-                      '%simpletest_directory' => SIMPLE_TEST));
-    drupal_set_message($output, 'error');
-    return false;
+    define('SIMPLE_TEST', drupal_get_path('module', 'simpletest') .'/simpletest'); 
+  }
+  if (!is_dir(SIMPLE_TEST)) {
+    return simpletest_trigger_error('not available');
   }
   
-  /* We currently use only the web tester that DrupalTestCase is built upon */
-  require_once(SIMPLE_TEST . '/web_tester.php');
-  require_once(SIMPLE_TEST . '/reporter.php');
+  // We currently use only the web tester that DrupalTestCase is built upon
+  require_once(SIMPLE_TEST .'/web_tester.php');
+  require_once(SIMPLE_TEST .'/reporter.php');
   require_once('drupal_reporter.php');
  
-  if (version_compare(SimpleTest::getVersion() , '1.0.1beta2') < 0) {
-    $output = t('Due to a lot of refactoring done on simpletest library side. Simpletest module is not compatible with simpeltest versions lower thab 1.0.1beta2. '
-              . 'Please download the latest version from !simpletest_link and place it into the same directory as simpletest.module: %simpletest_directory',
-                array('!simpletest_link' => l('Simpletest on SourceForge', 'https://sourceforge.net/project/showfiles.php?group_id=76550'),
-                      '%simpletest_directory' => SIMPLE_TEST));
-    drupal_set_message($output, 'error');
-    return false;
+  if (version_compare(SimpleTest::getVersion(), '1.0.1beta2') < 0) {
+    return simpletest_trigger_error('stale version');
   }
   
-
-  
-  $path = drupal_get_path('module', 'simpletest'). '/';
-  require_once($path . 'drupal_test_case.php');
-  require_once($path . 'drupal_unit_tests.php');
+  $path = drupal_get_path('module', 'simpletest') .'/';
+  require_once($path .'drupal_test_case.php');
+  require_once($path .'drupal_unit_tests.php');
   return true;
 }
 
-
 /**
  * Menu callback for both running tests and listing possible tests
  */
 function simpletest_entrypoint() {
   if (!simpletest_load()) {
-    /**
-     * @todo find a better way for this return,
-     * currently needed to show error, true leads to page not found
-     */
+     // @TODO - Find a better way for this return.  It is currently needed to show error,
+     // and returning true leads to page not found
     return '&nbsp;';  
-  }  
-  drupal_add_js(drupal_get_path('module', 'simpletest') . '/simpletest.js', 'module');
+  }
+  drupal_add_js(drupal_get_path('module', 'simpletest') .'/simpletest.js', 'module');
   $output = drupal_get_form('simpletest_overview_form');
 
   if (simpletest_running_output()) {
-	print theme('page',  simpletest_running_output() . $output);
-  } else {
-	print theme('page', $output);	
+    return simpletest_running_output() . $output;
+  }
+  else {
+    return $output;
   }
 }
 
@@ -133,7 +100,7 @@ function simpletest_running_output($outp
  */
 function simpletest_overview_form_submit($form, &$form_state) {
   $form_state['redirect'] = FALSE;
-  switch ($form_state['values']['running_options']){
+  switch ($form_state['values']['running_options']) {
     
     case 'all_tests':
       $output  = simpletest_run_tests();
@@ -147,16 +114,13 @@ function simpletest_overview_form_submit
         }
       }
       if (count($tests_list) > 0 ) {
-				$output = simpletest_run_tests($tests_list);
-			}
-			else { 
-				// no test has been selected
-				drupal_set_message(t('No test has been selected.'), 'error');
-			}
-    break;  
+        $output = simpletest_run_tests($tests_list);
+        break;
+      }
+      // Fall through
     
     default:
-      drupal_set_message(t('No test has been selected.'), 'error');
+      simpletest_trigger_error('no tests selected');
   }
   
   simpletest_running_output($output);
@@ -164,7 +128,7 @@ function simpletest_overview_form_submit
 }
 
 /**
- * Create simpletest_overview_form 
+ * Form callback;  make the form to run tests
  */
 function simpletest_overview_form() {
   $output = array();
@@ -186,20 +150,40 @@ function simpletest_overview_form() {
     foreach($tests as $test) {
       $test_info = $test->get_info();
       $desc = $test_info['desc'];
-      $group['tests'][get_class($test)] = array('#type' => 'checkbox', '#title' => $test_info['name'], '#default_value' => 0,
-                                                   '#description' => $desc);
-      
+      $group['tests'][get_class($test)] = array(
+        '#type' => 'checkbox',
+        '#title' => $test_info['name'],
+        '#default_value' => 0,
+        '#description' => $desc,
+      );
     }
-    $output[] = array_merge($group,
-                     array('#type' => 'fieldset', '#collapsible' => FALSE, '#collapsed' => FALSE,
-                          '#title' => $group_test->getLabel(), '#attributes' => array('class' => 'select_all')));
+    $output[] = $group + array(
+      '#type' => 'fieldset',
+      '#collapsible' => FALSE,
+      '#title' => $group_test->getLabel(),
+      '#attributes' => array('class' => 'select_all'),
+    );
   }
   
-  $submit['running_options'] = array('#type' => 'radios', '#default_value' => 'selected_tests', 
-                    '#options' => array('all_tests' => t('Run all tests (WARNING, this may take a long time)'), 'selected_tests' => t('Run selected tests')));
-  $submit['op'] = array('#type' => 'submit', '#value' => t('Begin'));
-  $output[] = array_merge($submit,
-                  array('#type' => 'fieldset', '#collapsible' => FALSE, '#collapsed' => FALSE, '#title' => 'Run tests'));
+  $submit['running_options'] = array(
+    '#type' => 'radios',
+    '#default_value' => 'selected_tests', 
+    '#options' => array(
+      'all_tests' => t('Run all tests (WARNING, this may take a long time)'),
+      'selected_tests' => t('Run selected tests'),
+    ),
+  );
+  $submit['op'] = array(
+    '#type' => 'submit',
+    '#value' => t('Begin'),
+  );
+  
+  $output[] = $submit + array(
+    '#type' => 'fieldset',
+    '#collapsible' => FALSE,
+    '#collapsed' => FALSE,
+    '#title' => 'Run tests',
+  );
   return $output;
 }
 
@@ -217,11 +201,9 @@ function simpletest_run_tests($testlist 
       cache_clear_all();
       exit ($test->run(new TextReporter()) ? 0 : 1);
     }
-    //$reporter = &new HtmlReporter();
     $reporter = &new DrupalReporter();
     cache_clear_all();
     $test->run($reporter);
-//    exit;
     $test_running = FALSE;
     return $reporter->getOutput();
   }
@@ -231,8 +213,8 @@ function simpletest_run_tests($testlist 
  * Implementation of hook_simpletest().
  */
 function simpletest_simpletest() {
-	$dir = drupal_get_path('module', 'simpletest'). '/tests';
-	$tests = file_scan_directory($dir, '\.test$');
+  $dir = drupal_get_path('module', 'simpletest'). '/tests';
+  $tests = file_scan_directory($dir, '\.test$');
   return array_keys($tests);
 }
 
@@ -264,30 +246,29 @@ function simpletest_settings() {
   $form['http_auth'] = array(
     '#type' => 'fieldset',
     '#title' => t('HTTP authentication'),
-    '#description' => t('If needed, enter a username and password for reaching your web site. This is not a drupal username/password. This
-    is a login presented by your web server. Most sites may leave section empty.'));
+    '#description' => t('If needed, enter a username and password for reaching your web site. This is not a drupal username/password.') .
+                      t('This is a login presented by your web server. Most sites may leave section empty.'),
+  );
   $form['http_auth']['simpletest_httpauth'] = array(
     '#type' => 'checkbox',
     '#title' => t('Use http authentication'),
-    '#default_value' => variable_get('simpletest_httpauth', false)
+    '#default_value' => variable_get('simpletest_httpauth', false),
   );
   $form['http_auth']['simpletest_httpauth_username'] = array(
     '#type' => 'textfield',
     '#title' => t('Username'),
-    '#default_value' => variable_get('simpletest_httpauth_username', '')
+    '#default_value' => variable_get('simpletest_httpauth_username', ''),
   );
   $form['http_auth']['simpletest_httpauth_pass'] = array(
     '#title' => t('Password'),
     '#type' => 'password',
-    '#default_value' => variable_get('simpletest_httpauth_pass', '')
+    '#default_value' => variable_get('simpletest_httpauth_pass', ''),
   );
-  
   $form['devel'] = array(
     '#type' => 'fieldset',
     '#title' => t('Devel module settings'),
     '#description' => t('Devel module can cause problems if you have query log enabled. It will output a few thousand queries and crash your browser'),
   );
-  
   $form['devel']['simpletest_devel'] = array(
     '#type' => 'checkbox',
     '#title' => t('Use devel query log on test result pages'),
@@ -295,5 +276,22 @@ function simpletest_settings() {
   );
   
   return system_settings_form($form);
+}
 
+function simpletest_trigger_error($type) {
+  switch ($type) {
+    case 'not available':
+      $output = t('The simpletest framework cannot be found in the current installation. Please note that simpletest.module needs Simpletest framework to be installed. ');
+      $output .= t('Please download it from !simpletest_link and place it into the same directory as simpletest.module: %simpletest_directory', array('!simpletest_link' => l('Simpletest on SourceForge', 'https://sourceforge.net/project/showfiles.php?group_id=76550'), '%simpletest_directory' => SIMPLE_TEST));
+      drupal_set_message($output, 'error');
+      break;
+    case 'stale version':
+      $output = t('Due to a lot of refactoring done on simpletest library side. Simpletest module is not compatible with Simpletest versions lower than 1.0.1 beta2. ');
+      $output .= t('Please download the latest version from !simpletest_link and place it into the same directory as simpletest.module: %simpletest_directory', array('!simpletest_link' => l('Simpletest on SourceForge', 'https://sourceforge.net/project/showfiles.php?group_id=76550'), '%simpletest_directory' => SIMPLE_TEST));
+      drupal_set_message($output, 'error');
+      break;
+    case 'no test selected':
+      drupal_set_message(t('No test has been selected.'), 'error');
+  }
+  return false;
 }
Index: tests/page_creation.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/page_creation.test,v
retrieving revision 1.13
diff -u -p -r1.13 page_creation.test
--- tests/page_creation.test	18 Sep 2007 14:59:13 -0000	1.13
+++ tests/page_creation.test	24 Dec 2007 19:03:48 -0000
@@ -34,4 +34,4 @@ class PageCreationTest extends  DrupalTe
     
   }
 }
-?>
\ No newline at end of file
+
Index: tests/page_view.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/page_view.test,v
retrieving revision 1.10
diff -u -p -r1.10 page_view.test
--- tests/page_view.test	18 Sep 2007 14:59:13 -0000	1.10
+++ tests/page_view.test	24 Dec 2007 19:03:48 -0000
@@ -56,4 +56,3 @@ class PageViewTest extends DrupalTestCas
     node_delete(array('nid' => $node->nid));
   }
 }
-?>
Index: tests/user_registration_test.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/user_registration_test.test,v
retrieving revision 1.11
diff -u -p -r1.11 user_registration_test.test
--- tests/user_registration_test.test	8 Sep 2007 23:02:40 -0000	1.11
+++ tests/user_registration_test.test	24 Dec 2007 19:03:48 -0000
@@ -14,7 +14,7 @@ class UserRegistrationTest extends Drupa
     $this->drupalVariableSet('user_register', 1);
     
     /* make sure the profiles module is disabled to avoid conflicts */
-    $this->drupalModuleDisable('profiles');
+    $this->drupalModuleDisable('profile');
     
     $name = $this->randomName();
     $mail = "$name@example.com";
@@ -29,8 +29,8 @@ class UserRegistrationTest extends Drupa
     // we can use an 'edit' array to load user variable
     $user = user_load($edit);
 
-    $this->assertTrue(isset($user->uid), 'user->uid set');
-    $this->assertTrue(($user->uid > 0), 'uid > 0');
+    $this->assertTrue(isset($user->uid), 'User ID set');
+    $this->assertTrue(($user->uid > 0), 'User ID is greater than 0');
     if (!isset($user->uid) || ($user->uid == 0)) {
       return FALSE;
     }
@@ -44,7 +44,7 @@ class UserRegistrationTest extends Drupa
     $this->assertEqual($user->signature, '','Checking signature field');
     $this->assertTrue(($user->created > time() - 20 ), 0,'Checking creation time.');
     $this->assertEqual($user->status, variable_get('user_register', 1) == 1 ? 1 : 0,'Checking status field');
-    $this->assertEqual($user->edit-timezone, NULL, 'Checking timezone field');
+    $this->assertEqual($user->edit->timezone, NULL, 'Checking timezone field');
     $this->assertEqual($user->language, '', 'Checking language field');
     $this->assertEqual($user->picture, '', 'Check picture field');
     $this->assertEqual($user->init, $mail, 'Check init field');
@@ -52,7 +52,7 @@ class UserRegistrationTest extends Drupa
     /* We try to login with a wrong password */
     $login_edit = array('name' => $name, 'pass' => 'foo');
     $this->drupalPostRequest('user', $login_edit, 'Log in');
-    $this->assertText(t('Sorry, unrecognized username or password. Have you forgotten your password?'), 'Test for failed Login');
+    $this->assertText(t('Sorry, unrecognized username or password. Have you forgotten your password?'), 'Test for failed login');
     $url = user_pass_reset_url($user);
     /* TODO: find a better way, we currently have to do it that way, see user.module line 1041. */
     sleep(1);
@@ -60,7 +60,7 @@ class UserRegistrationTest extends Drupa
     
     // Will proabaly not work localised as the text is sent to tranlate wrapped in <p> usually
 
-    $this->assertText(t('This login can be used only once.'), "Check for 'used only once' notice");
+    $this->assertText(t('This login can be used only once.'), "Check for 'login can be used only once' notice");
  
     $this->_browser->clickSubmit(t('Log in'));
     $this->assertText(t('You have just used your one-time login link. It is no longer necessary to use this link to login. Please change your password.'), "Check for one time login notice after clicking Login button.");
@@ -99,4 +99,3 @@ class UserRegistrationTest extends Drupa
     db_query('DELETE FROM {authmap} WHERE uid = %d', $user->uid);
   }
 }
-?>
