? simpletest
Index: simpletest.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/simpletest.info,v
retrieving revision 1.2
diff -u -r1.2 simpletest.info
--- simpletest.info	2 Sep 2006 18:56:57 -0000	1.2
+++ simpletest.info	18 Mar 2007 16:43:28 -0000
@@ -1,3 +1,5 @@
-; $Id: simpletest.info,v 1.2 2006/09/02 18:56:57 rokZlender Exp $
-name = Simpletest
-description = Allows to run unit tests on the Drupal codebase.
+; $Id $
+name = "SimpleTest module"
+description = "Provides simpletest classes to developers as well as some standard tests for Drupal"
+package = Simpletest
+version = "$Name$"
\ No newline at end of file
Index: simpletest.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/simpletest.module,v
retrieving revision 1.21
diff -u -r1.21 simpletest.module
--- simpletest.module	25 Dec 2006 11:43:39 -0000	1.21
+++ simpletest.module	18 Mar 2007 17:01:53 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: simpletest.module,v 1.21 2006/12/25 11:43:39 rokZlender Exp $
+// $Id: simpletest.module,v 1.15.2.1 2007/02/25 12:20:34 rokZlender Exp $
 
 /**
  * Implementation of hook_help().
@@ -69,7 +69,7 @@
   /* 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');
+  //require_once('drupal_reporter.php');
  
   if (version_compare(SimpleTest::getVersion() , '1.0.1alpha3') < 0) {
     $output = t('Due to a recently discovered %bug_link the drupal simpletest module is not compatible with versions prior to 1.0.1alpha3. '
@@ -101,40 +101,49 @@
      */
     return '&nbsp;';  
   }  
-  $op = $_POST['op'];
-  $edit = $_POST;
-  if (empty($op)) {
-		$op = arg(2);
-	}
-	switch ($op) {
-		case t('Run All Tests'):
+	$output = drupal_get_form('simpletest_overview_form');
+	print theme('page', $output);	
+}
+
+/**
+ * FAPI form submit for simpletest_overview_form
+ *
+ * @param $form_id 
+ * @param $form_values
+ */
+function simpletest_overview_form_submit($form_id, $form_values) {
+  
+  switch ($form_values['running_options']){
+    
+    case 'all_tests':
       $output  = simpletest_run_tests();
-  		break;
-		
-		case t('Run Selected Tests'):
-		  $tests_list = array();
-			foreach($edit as $test => $checked) {
-				if ($checked && ($test != 'form_id') && ($test != 'op') && ($test != 'form_token')) {
-					$tests_list[] = $test;
-				}
-			}
-			if (count($tests_list) > 0 ) {
-				$output = simpletest_run_tests($tests_list);  	 	 
+    break;    
+    
+    case 'selected_tests':
+      $test_list = array();
+      foreach ($form_values as $test => $checked){
+        if ($checked && ($test != 'running_options' && $test != 'op' && $test != 'form_token' && $test != 'form_id')) {
+          $tests_list[] = $test;
+        }
+      }
+      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');
-				/** @FIXME!!! */
-//				$output = form_submit(t('Back to Menu'));
-//				$output = form($output);
 			}
-			break;
-		default:
-			$output = drupal_get_form('simpletest_overview_form');
+    break;  
+    
+    default:
+      drupal_set_message(t('No test has been selected.'), 'error');
+
   }
-	print theme('page', $output);	
 }
 
+/**
+ * Create simpletest_overview_form 
+ */
 function simpletest_overview_form() {
   $output = array();
   $total_test = &simpletest_get_total_test();
@@ -154,13 +163,16 @@
                     array('#type' => 'fieldset', '#collapsible' => TRUE, '#collapsed' => FALSE,
                           '#title' => $group_test->getLabel()));
   }
-  $submit[] = array('#type' => 'submit', '#value' => t('Run All Tests'));
-  $submit[] = array('#type' => 'submit', '#value' => t('Run Selected Tests'));
+  
+  $submit['running_options'] = array('#type' => 'radios',
+                    '#options' => array('all_tests' => t('Run all tests'), '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', '#description' => t('WARNING, this may take a long time.')));
   return $output;
 }
 
+
 /**
  * Actually runs tests
  * @param array $testlist list of tests to run or DEFAULT NULL run all tests
@@ -173,12 +185,12 @@
       cache_clear_all();
       exit ($test->run(new TextReporter()) ? 0 : 1);
     }
-    //$reporter = &new HtmlReporter();
-    $reporter = &new DrupalReporter();
+    $reporter = &new HtmlReporter();
+    //$reporter = &new DrupalReporter();
     cache_clear_all();
     $test->run($reporter);
 //    exit;
-    return $reporter->getOutput();
+//    return $reporter->getOutput();
   }
 }
 
Index: tests/upload_tests.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/upload_tests.test,v
retrieving revision 1.7
diff -u -r1.7 upload_tests.test
--- tests/upload_tests.test	2 Sep 2006 18:03:59 -0000	1.7
+++ tests/upload_tests.test	18 Mar 2007 17:04:01 -0000
@@ -386,7 +386,6 @@
 
       // get full url to the user's image
       $picture = file_create_url($pic_path);
-      
 
       // check if image is displayed in user's profile page
       $content = $this->drupalGetContent();
Index: tests/user_registration_test.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/user_registration_test.test,v
retrieving revision 1.9
diff -u -r1.9 user_registration_test.test
--- tests/user_registration_test.test	6 Sep 2006 08:11:50 -0000	1.9
+++ tests/user_registration_test.test	18 Mar 2007 16:58:46 -0000
@@ -52,7 +52,7 @@
     /* We try to login with a wrong password */
     $login_edit = array('name' => $name, 'pass' => 'foo');
     $this->drupalPostRequest('user', $login_edit, 'Log in');
-    $this->assertWantedText(t('Sorry, unrecognized username or password.'), 'Test for failed Login');
+    $this->assertWantedText(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);
@@ -77,8 +77,8 @@
     $this->assertEqual($user->pass, md5($new_pass), 'Correct password in database');
     
     /* logout */
-    $this->clickLink('log out'); 
-    $this->assertNoUnwantedText($user->name, 'Logged out');
+    $this->clickLink('Log out'); 
+    $this->assertNoText($user->name, 'Logged out');
     
     /* login again */
     $login_edit['pass'] = $new_pass;
Index: tests/user_validation.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/user_validation.test,v
retrieving revision 1.1
diff -u -r1.1 user_validation.test
--- tests/user_validation.test	24 Aug 2005 19:10:02 -0000	1.1
+++ tests/user_validation.test	18 Mar 2007 16:59:10 -0000
@@ -20,7 +20,7 @@
     $this->assertNotNull($result, 'Invalid chars in username');
   }
   function testMaxLengthName() {
-    $name = str_repeat('a', 57);
+    $name = str_repeat('a', 61);
     $result = user_validate_name($name);
     $this->assertNotNull($result, 'Excessively long username');
   }
