? .svn
? php5powah_tests.patch
? simpletest
? simpletest_orig
? tests/.svn
? tests/pager.test
? tests/patch
Index: drupal_test_case.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/drupal_test_case.php,v
retrieving revision 1.55
diff -u -p -r1.55 drupal_test_case.php
--- drupal_test_case.php	15 Mar 2008 22:40:52 -0000	1.55
+++ drupal_test_case.php	16 Mar 2008 19:24:38 -0000
@@ -3,38 +3,44 @@
 
 /**
  * Test case for typical Drupal tests.
- * Extends WebTestCase for comfortable browser usage
- * but also implements all UnitTestCase methods, I wish
- * WebTestCase would do this.
  */
-class DrupalTestCase extends WebTestCase {
-  var $_content;
-  var $_originalModules     = array();
-  var $_modules             = array();
-  var $_cleanupVariables    = array();
-  var $_cleanupUsers        = array();
-  var $_cleanupRoles        = array();
-  var $_cleanupNodes        = array();
-  var $_cleanupContentTypes = array();
+class DrupalTestCase extends UnitTestCase {
+  protected $_content;
+  protected $plain_text;
+  protected $_originalModules     = array();
+  protected $_modules             = array();
+  protected $_cleanupVariables    = array();
+  protected $_cleanupUsers        = array();
+  protected $_cleanupRoles        = array();
+  protected $_cleanupNodes        = array();
+  protected $_cleanupContentTypes = array();
+  protected $ch;
+  // We do not reuse the cookies in further runs, so we do not need a file
+  // but we still need cookie handling, so we set the jar to NULL
+  protected $cookie_file = NULL;
+  // Overwrite this any time to supply cURL options as necessary,
+  // DrupalTestCase itself never sets this but always obeys whats set.
+  protected $curl_options         = array();
 
-
-  function DrupalTestCase($label = NULL) {
-    if (! $label) {
+  function __construct($label = NULL) {
+    if (!$label) {
       if (method_exists($this, 'get_info')) {
         $info  = $this->get_info();
         $label = $info['name'];
       }
     }
-    $this->WebTestCase($label);
+    parent::__construct($label);
   }
-  
+
   /**
    * Creates a node based on default settings.
    *
-   * @param settings An array of settings to change from the defaults, in the form of 'body' => 'Hello, world!'
+   * @param settings
+   *   An assocative array of settings to change from the defaults, keys are
+   *   node properties, for example 'body' => 'Hello, world!'.
    */
   function drupalCreateNode($settings = array()) {
- 
+
     // Populate defaults array
     $defaults = array(
       'body'      => $this->randomName(32),
@@ -57,16 +63,15 @@ class DrupalTestCase extends WebTestCase
     if (isset($defaults['created'])) {
       $defaults['date'] = format_date($defaults['created'], 'custom', 'Y-m-d H:i:s O');
     }
-    
     if (empty($settings['uid'])) {
       global $user;
       $defaults['uid'] = $user->uid;
     }
     $node = ($settings + $defaults);
     $node = (object)$node;
- 
+
     node_save($node);
-    
+
     // small hack to link revisions to our test user
     db_query('UPDATE {node_revisions} SET uid = %d WHERE vid = %d', $node->uid, $node->vid);
     $this->_cleanupNodes[] = $node->nid;
@@ -76,7 +81,9 @@ class DrupalTestCase extends WebTestCase
   /**
    * Creates a custom content type based on default settings.
    *
-   * @param settings An array of settings to change from the defaults, in the form of 'type' => 'foo'
+   * @param settings
+   *   An array of settings to change from the defaults.
+   *   Example: 'type' => 'foo'.
    */
   function drupalCreateContentType($settings = array()) {
     // find a non-existent random type name.
@@ -116,143 +123,6 @@ class DrupalTestCase extends WebTestCase
   }
 
   /**
-   * @abstract Checks to see if we need to send
-   * a http-auth header to authenticate
-   * when browsing a site.
-   *
-   * @param status Boolean pass true if you want to know if we are using
-   * HTTP-AUTH
-   * @return void
-   */
-  function drupalCheckAuth($status = false) {
-    $check = variable_get('simpletest_httpauth', false);
-    if( $status ) {
-      return $check;
-    }
-    if( variable_get('simpletest_httpauth', false) ) {
-      $html = $this->authenticate(variable_get('simpletest_httpauth_username', ''), variable_get('simpletest_httpauth_pass', ''));
-    }
-    return $html;
-  }
-
-  /**
-   * @abstract Broker for the get function
-   * adds the authentication headers if necessary
-   * @author Earnest Berry III <earnest.berry@gmail.com>
-   *
-   * @param $path string Drupal path or url to load into internal browser
-   * @param array $options Options to be forwarded to url().
-   * @return void
-   */
-  function drupalGet($path, $options = array()) {
-    $url = url($path, array_merge($options, array('absolute' => TRUE)));
-    $html = $this->_browser->get($url);
-
-    if ($this->drupalCheckAuth(true)) {
-      $html .= $this->drupalCheckAuth();
-    }
-
-    $this->_content = $this->_browser->getContent();
-
-    return $html;
-  }
-
-  /**
-   * @abstract Broker for the post function
-   * adds the authentication headers if
-   * necessary
-   * @author Earnest Berry III <earnest.berry@gmail.com>
-   *
-   * @param url string Url to retch
-   * @return void
-   */
-  function drupalRawPost($action, $edit = array()) {
-    $html = $this->_browser->post($action, $edit);
-
-    if( $this->drupalCheckAuth(true) ) {
-      $html .= $this->drupalCheckAuth();
-    }
-
-    $this->_content = $this->_browser->getContent();
-
-    return $html;
-  }
-
-
-
-  /**
-   * Do a post request on a drupal page.
-   * It will be done as usual post request with SimpleBrowser
-   * By $reporting you specify if this request does assertions or not
-   * Warning: empty ("") returns will cause fails with $reporting
-   *
-   * @param string  $path
-   *   Location of the post form. Either a Drupal path or an absolute path or
-   *   NULL to post to the current page.
-   * @param array $edit
-   *   Field data in an assocative array. Changes the current input fields
-   *   (where possible) to the values indicated. A checkbox can be set to
-   *   TRUE to be checked and FALSE to be unchecked.
-   * @param string $submit
-   *   Untranslated value, id or name of the submit button.
-   */
-  function drupalPost($path, $edit = array(), $submit) {
-    if (isset($path)) {
-      $ret = $this->drupalGet($path);
-      $this->assertTrue($ret, t(' [browser] GET path "@path"', array('@path' => $path)));
-    }
-
-    foreach ($edit as $field_name => $field_value) {
-      $ret = $this->_browser->setFieldByName($field_name, $field_value)
-          || $this->_browser->setFieldById("edit-$field_name", $field_value);
-      $this->assertTrue($ret, " [browser] Setting $field_name=\"$field_value\"");
-    }
-
-    $ret = $this->_browser->clickSubmit(t($submit))  || $this->_browser->clickSubmitById($submit) || $this->_browser->clickSubmitByName($submit) || $this->_browser->clickImageByName($submit);
-    $this->assertTrue($ret, ' [browser] POST by click on ' . t($submit));
-    $this->_content = $this->_browser->getContent();
-  }
-
-  /**
-   *    Follows a link by name.
-   *
-   *    Will click the first link found with this link text by default, or a
-   *    later one if an index is given. Match is case insensitive with
-   *    normalized space. The label is translated label. There is an assert
-   *    for successful click.
-   *    WARNING: Assertion fails on empty ("") output from the clicked link
-   *
-   *    @param string $label      Text between the anchor tags.
-   *    @param integer $index     Link position counting from zero.
-   *    @param boolean $reporting Assertions or not
-   *    @return boolean/string    Page on success.
-   *
-   *    @access public
-   */
-  function clickLink($label, $index = 0) {
-    $url_before = str_replace('%', '%%', $this->getUrl());
-    $urls = $this->_browser->_page->getUrlsByLabel($label);
-    if (count($urls) < $index + 1) {
-      $url_target = 'URL NOT FOUND!';
-    } else {
-      $url_target = str_replace('%', '%%', $urls[$index]->asString());
-    }
-
-    $ret = parent::clickLink(t($label), $index);
-
-    $this->assertTrue($ret, ' [browser] clicked link '. t($label) . " ($url_target) from $url_before");
-
-    return $ret;
-  }
-
-  /**
-   * @TODO: needs documentation
-   */
-  function drupalGetContent() {
-    return $this->_content;
-  }
-
-  /**
    * Generates a random string, to be used as name or whatever
    * @param integer $number   number of characters
    * @return random string
@@ -283,7 +153,7 @@ class DrupalTestCase extends WebTestCase
       $this->_modules[$name] = $name;
       $form_state['values'] = array('status' => $this->_modules, 'op' => t('Save configuration'));
       drupal_execute('system_modules', $form_state);
-      
+
       //rebuilding all caches
       drupal_rebuild_theme_registry();
       node_types_rebuild();
@@ -309,7 +179,7 @@ class DrupalTestCase extends WebTestCase
       unset($this->_modules[$key]);
       $form_state['values'] = array('status' => $this->_modules, 'op' => t('Save configuration'));
       drupal_execute('system_modules', $form_state);
-      
+
       //rebuilding all caches
       drupal_rebuild_theme_registry();
       node_types_rebuild();
@@ -331,7 +201,7 @@ class DrupalTestCase extends WebTestCase
       $this->_modules = $this->_originalModules;
     }
   }
-  
+
   /**
    * Set a drupal variable and keep track of the changes for tearDown()
    * @param string $name name of the value
@@ -420,10 +290,6 @@ class DrupalTestCase extends WebTestCase
    * @param $submit value of submit button on log in form
    */
   function drupalLoginUser($user = NULL, $submit = 'Log in') {
-
-    $this->drupalGet('user');
-    // Going to the page retrieves the cookie, as the browser should save it
-
     if ($user === NULL) {
       $user = $this->drupalCreateUserRolePerm();
     }
@@ -446,15 +312,15 @@ class DrupalTestCase extends WebTestCase
     if ($this->_modules != $this->_originalModules) {
       $form_state['values'] = array('status' => $this->_originalModules, 'op' => t('Save configuration'));
       drupal_execute('system_modules', $form_state);
-      
+
       //rebuilding all caches
       drupal_rebuild_theme_registry();
       node_types_rebuild();
       menu_rebuild();
       cache_clear_all('schema', 'cache');
       module_rebuild_cache();
-    
-      $this->_modules = $this->_originalModules; 
+
+      $this->_modules = $this->_originalModules;
     }
 
     foreach ($this->_cleanupVariables as $name => $value) {
@@ -465,7 +331,7 @@ class DrupalTestCase extends WebTestCase
       }
     }
     $this->_cleanupVariables = array();
-    
+
     //delete nodes
     foreach ($this->_cleanupNodes as $nid) {
       node_delete($nid);
@@ -520,301 +386,301 @@ class DrupalTestCase extends WebTestCase
     array_pop($reporter->test_info_stack);
   }
 
-
-        /**
-         *    Will trigger a pass if the raw text is found on the loaded page
-         *    Fail otherwise.
-         *    @param string $raw        Raw string to look for
-         *    @param string $message    Message to display.
-         *    @return boolean           True on pass
-         *    @access public
-         */
-        function assertWantedRaw($raw, $message = "%s") {
-          return $this->assertExpectation(
-                  new TextExpectation($raw),
-                  $this->_browser->getContent(),
-                  $message);
-        }
-
-
-        /**
-         *    Will trigger a pass if the raw text is NOT found on the loaded page
-         *    Fail otherwise.
-         *    @param string $raw        Raw string to look for
-         *    @param string $message    Message to display.
-         *    @return boolean           True on pass
-         *    @access public
-         */
-        function assertNoUnwantedRaw($raw, $message = "%s") {
-          return $this->assertExpectation(
-                  new NoTextExpectation($raw),
-                  $this->_browser->getContent(),
-                  $message);
-        }
-  /* Taken from UnitTestCase */
-        /**
-         *    Will be true if the value is null.
-         *    @param null $value       Supposedly null value.
-         *    @param string $message   Message to display.
-         *    @return boolean                        True on pass
-         *    @access public
-         */
-        function assertNull($value, $message = "%s") {
-            $dumper = &new SimpleDumper();
-            $message = sprintf(
-                    $message,
-                    "[" . $dumper->describeValue($value) . "] should be null");
-            return $this->assertTrue(! isset($value), $message);
+  /**
+   * Initializes the cURL connection and gets a session cookie.
+   *
+   * This function will add authentaticon headers as necessary. Also, you can
+   * set $this->
+   */
+  protected function curlConnect() {
+    global $base_url;
+    if (!isset($this->ch)) {
+      $this->ch = curl_init();
+      $curl_options = $this->curl_options + array(
+        CURLOPT_COOKIEJAR => $this->cookie_file,
+        CURLOPT_URL => $base_url,
+        CURLOPT_FOLLOWLOCATION => TRUE,
+        CURLOPT_RETURNTRANSFER => TRUE,
+      );
+      if (!isset($curl_options[CURLOPT_USERPWD]) && ($auth = variable_get('simpletest_httpauth_username', ''))) {
+        if ($pass = variable_get('simpletest_httpauth_pass', '')) {
+          $auth .= ':'. $pass;
         }
+        $curl_options[CURLOPT_USERPWD] = $auth;
+      }
+      return $this->curlExec($curl_options);
+    }
+  }
 
-        /**
-         *    Will be true if the value is set.
-         *    @param mixed $value           Supposedly set value.
-         *    @param string $message        Message to display.
-         *    @return boolean               True on pass.
-         *    @access public
-         */
-        function assertNotNull($value, $message = "%s") {
-            $dumper = &new SimpleDumper();
-            $message = sprintf(
-                    $message,
-                    "[" . $dumper->describeValue($value) . "] should not be null");
-            return $this->assertTrue(isset($value), $message);
-        }
+  protected function curlExec($curl_options) {
+    $this->curlConnect();
+    curl_setopt_array($this->ch, $this->curl_options + $curl_options);
+    $this->_content = curl_exec($this->ch);
+    $this->plain_text = FALSE;
+    $this->elements = FALSE;
+    return $this->_content;
+  }
 
-        /**
-         *    Type and class test. Will pass if class
-         *    matches the type name or is a subclass or
-         *    if not an object, but the type is correct.
-         *    @param mixed $object         Object to test.
-         *    @param string $type          Type name as string.
-         *    @param string $message       Message to display.
-         *    @return boolean              True on pass.
-         *    @access public
-         */
-        function assertIsA($object, $type, $message = "%s") {
-            return $this->assertExpectation(
-                    new IsAExpectation($type),
-                    $object,
-                    $message);
-        }
+  protected function parse() {
+    if (!$this->elements) {
+      // DOM can load HTML soup. Life is good.
+      $htmlDom = DOMDocument::loadHTML($this->_content);
+      if ($htmlDom) {
+        $this->assertTrue(TRUE, t('Valid HTML found on "@path"', array('@path' => $this->getUrl())));
+        // It's much easier to work with simplexml than DOM, luckily enough
+        // we can just simply import our DOM tree.
+        $this->elements = simplexml_import_dom($htmlDom);
+      }
+    }
+    return $this->elements;
+  }
+  /**
+   * Retrievs a Drupal path or an absolute path.
+   *
+   * @param $path
+   *   string Drupal path or url to load into internal browser
+   * @param array
+   *   $options Options to be forwarded to url().
+   * @return
+   *   The retrieved HTML string, also available as $this->drupalGetContent()
+   */
+  function drupalGet($path, $options = array()) {
+    $options['absolute'] = TRUE;
+    return $this->curlExec(array(CURLOPT_URL => url($path, $options)));
+  }
 
-        /**
-         *    Type and class mismatch test. Will pass if class
-         *    name or underling type does not match the one
-         *    specified.
-         *    @param mixed $object         Object to test.
-         *    @param string $type          Type name as string.
-         *    @param string $message       Message to display.
-         *    @return boolean              True on pass.
-         *    @access public
-         */
-        function assertNotA($object, $type, $message = "%s") {
-            return $this->assertExpectation(
-                    new NotAExpectation($type),
-                    $object,
-                    $message);
+  /**
+   * Do a post request on a drupal page.
+   * It will be done as usual post request with SimpleBrowser
+   * By $reporting you specify if this request does assertions or not
+   * Warning: empty ("") returns will cause fails with $reporting
+   *
+   * @param string  $path
+   *   Location of the post form. Either a Drupal path or an absolute path or
+   *   NULL to post to the current page.
+   * @param array $edit
+   *   Field data in an assocative array. Changes the current input fields
+   *   (where possible) to the values indicated. A checkbox can be set to
+   *   TRUE to be checked and FALSE to be unchecked.
+   * @param string $submit
+   *   Untranslated value, id or name of the submit button.
+   */
+  function drupalPost($path, $edit, $submit) {
+    if (isset($path)) {
+      $html = $this->drupalGet($path);
+      $this->assertTrue($html, t(' [browser] GET path "@path"', array('@path' => $path)));
+    }
+    $post = array();
+    // @TODO -- we need something better here.
+    $edit['op'] = $submit;
+    if ($this->parse()) {
+      // Let's iterate over all the forms.
+      foreach ($this->elements->xpath('//form') as $form) {
+        // We try to set the fields of this form as specified in $edit.
+        // If we manage to set just one field from edit, we deem that a
+        // success. @TODO: submit is a problem here, too.
+        if ($post = $this->handleForm($form, $edit)) {
+          // $edit should be empty at this point.
+          $this->assertFalse($edit, t('All fields are set'));
+          return $this->curlExec(array(CURLOPT_POSTFIELDS => $post));
         }
+      }
+    }
+    // Bummer!
+    $this->assertTrue(FALSE, t('Found the requested form'));
+  }
 
-        /**
-         *    Will trigger a pass if the two parameters have
-         *    the same value only. Otherwise a fail.
-         *    @param mixed $first          Value to compare.
-         *    @param mixed $second         Value to compare.
-         *    @param string $message       Message to display.
-         *    @return boolean              True on pass
-         *    @access public
-         */
-        function assertEqual($first, $second, $message = "%s") {
-            return $this->assertExpectation(
-                    new EqualExpectation($first),
-                    $second,
-                    $message);
+  protected function handleForm($form, &$edit) {
+    // Retrieve the form elements...
+    $elements = $form->xpath('//input|//textarea|//select');
+    $found = FALSE;
+    foreach ($elements as $element) {
+      // SimpleXML objects need string casting all the time.
+      $name = (string)$element['name'];
+      // This can either be the type of <input> or the name of the tag itself.
+      $type = isset($element['type']) ? (string)$element['type'] : $element->getName();
+      $error = FALSE;
+      $handled = FALSE;
+      if (isset($edit[$name])) {
+        switch ($type) {
+          case 'text': case 'textarea': case 'submit': case 'image': case 'password':
+            $post[$name] = $edit[$name];
+            $handled = TRUE;
+            break;
+          case 'radio':
+            if ($edit[$name] == $value) {
+              $post[$name] = $edit[$name];
+              $handled = TRUE;
+            }
+            break;
+          case 'checkbox':
+            // Prevent checkbox from being checked.
+            if ($edit[$name] === FALSE) {
+              $handled = TRUE;
+            }
+            break;
+          case 'select':
+            foreach ($element->option as $option) {
+              if ($edit[$name] == $option) {
+                $post[$name] = $edit[$name];
+                $handled = TRUE;
+                break 2;
+              }
+            }
+          default:
+            $error = TRUE;
+            $this->assertTrue(FALSE, t('You tried to change a field type !type which can not be changed.', array('!type' => $type)));
+        }
+        if ($handled) {
+          $found = TRUE;
+          unset($edit[$name]);
         }
-
-        /**
-         *    Will trigger a pass if the two parameters have
-         *    a different value. Otherwise a fail.
-         *    @param mixed $first           Value to compare.
-         *    @param mixed $second          Value to compare.
-         *    @param string $message        Message to display.
-         *    @return boolean               True on pass
-         *    @access public
-         */
-        function assertNotEqual($first, $second, $message = "%s") {
-            return $this->assertExpectation(
-                    new NotEqualExpectation($first),
-                    $second,
-                    $message);
+      }
+      if (!isset($post[$name]) && !$error && !$handled) {
+        switch ($type) {
+          case 'select':
+            // @TODO: handle multiple selected in a multiple SELECT.
+            foreach ($element->option as $option) {
+              if ($option['selected']) {
+                $post[$name] = (string)$option['value'];
+              }
+            }
+            if (!isset($post[$name])) {
+              $post[$name] = (string)$element->option[0]['value'];
+            }
+            break;
+          case 'radio':
+            if (!isset($element['checked'])) {
+              break;
+            }
+          // Deliberate no break.
+          default:
+            $post[$name] = (string)$element['value'];
         }
+      }
+    }
+    if ($found) {
+      return $post;
+    }
+  }
 
-        /**
-         *    Will trigger a pass if the two parameters have
-         *    the same value and same type. Otherwise a fail.
-         *    @param mixed $first           Value to compare.
-         *    @param mixed $second          Value to compare.
-         *    @param string $message        Message to display.
-         *    @return boolean               True on pass
-         *    @access public
-         */
-        function assertIdentical($first, $second, $message = "%s") {
-            return $this->assertExpectation(
-                    new IdenticalExpectation($first),
-                    $second,
-                    $message);
-        }
+  /**
+   *    Follows a link by name.
+   *
+   *    Will click the first link found with this link text by default, or a
+   *    later one if an index is given. Match is case insensitive with
+   *    normalized space. The label is translated label. There is an assert
+   *    for successful click.
+   *    WARNING: Assertion fails on empty ("") output from the clicked link
+   *
+   *  @param string $label      Text between the anchor tags.
+   *  @param integer $index     Link position counting from zero.
+   *  @param boolean $reporting Assertions or not
+   *    @return boolean/string    Page on success.
+   *
+   *    @access public
+   */
+  function clickLink($label, $index = 0) {
+    $url_before = $this->getUrl();
+    $ret = FALSE;
+    if ($this->parse()) {
+      $urls = $this->elements->xpath('//a[text()="'. $label .'"]');
+      if (isset($urls[$index])) {
+        $curl_options = array(CURLOPT_URL => $urls[$index]['href']);
+        $ret = $this->curlExec($curl_options);
+      }
+      $this->assertTrue($ret, ' [browser] clicked link '. t($label) . " ($url_target) from $url_before");
+    }
+    return $ret;
+  }
 
-        /**
-         *    Will trigger a pass if the two parameters have
-         *    the different value or different type.
-         *    @param mixed $first           Value to compare.
-         *    @param mixed $second          Value to compare.
-         *    @param string $message        Message to display.
-         *    @return boolean               True on pass
-         *    @access public
-         */
-        function assertNotIdentical($first, $second, $message = "%s") {
-            return $this->assertExpectation(
-                    new NotIdenticalExpectation($first),
-                    $second,
-                    $message);
-        }
+  function getUrl() {
+    return curl_getinfo($this->ch, CURLINFO_EFFECTIVE_URL);
+  }
 
-        /**
-         *    Will trigger a pass if both parameters refer
-         *    to the same object. Fail otherwise.
-         *    @param mixed $first           Object reference to check.
-         *    @param mixed $second          Hopefully the same object.
-         *    @param string $message        Message to display.
-         *    @return boolean               True on pass
-         *    @access public
-         */
-        function assertReference(&$first, &$second, $message = "%s") {
-            $dumper = &new SimpleDumper();
-            $message = sprintf(
-                    $message,
-                    "[" . $dumper->describeValue($first) .
-                            "] and [" . $dumper->describeValue($second) .
-                            "] should reference the same object");
-            return $this->assertTrue(
-                    SimpleTestCompatibility::isReference($first, $second),
-                    $message);
-        }
+  /**
+   * Gets the current raw HTML.
+   */
+  function drupalGetContent() {
+    return $this->_content;
+  }
 
-        /**
-         *    Will trigger a pass if both parameters refer
-         *    to different objects. Fail otherwise.
-         *    @param mixed $first           Object reference to check.
-         *    @param mixed $second          Hopefully not the same object.
-         *    @param string $message        Message to display.
-         *    @return boolean               True on pass
-         *    @access public
-         */
-        function assertCopy(&$first, &$second, $message = "%s") {
-            $dumper = &new SimpleDumper();
-            $message = sprintf(
-                    $message,
-                    "[" . $dumper->describeValue($first) .
-                            "] and [" . $dumper->describeValue($second) .
-                            "] should not be the same object");
-            return $this->assertFalse(
-                    SimpleTestCompatibility::isReference($first, $second),
-                    $message);
-        }
+  /**
+   *    Pass if the raw text IS found on the loaded page, fail otherwise.
+   *
+   *  @param string $raw
+   *    Raw string to look for
+   *  @param string $message
+   *    Message to display.
+   *    @return
+   *    TRUE on pass
+   */
+  function assertWantedRaw($raw, $message = "%s") {
+    return $this->assertFalse(strpos($this->_content, $raw) === FALSE, $message);
+  }
 
-        /**
-         *    Will trigger a pass if the Perl regex pattern
-         *    is found in the subject. Fail otherwise.
-         *    @param string $pattern    Perl regex to look for including
-         *                              the regex delimiters.
-         *    @param string $subject    String to search in.
-         *    @param string $message    Message to display.
-         *    @return boolean           True on pass
-         *    @access public
-         */
-        function assertWantedPattern($pattern, $subject, $message = "%s") {
-            return $this->assertExpectation(
-                    new WantedPatternExpectation($pattern),
-                    $subject,
-                    $message);
-        }
+  /**
+   *    Pass if the raw text is NOT found on the loaded page, fail otherwise.
+   *
+   *  @param string $raw
+   *    Raw string to look for
+   *  @param string $message
+   *    Message to display.
+   *    @return
+   *    TRUE on pass
+   */
+  function assertNoUnwantedRaw($raw, $message = "%s") {
+    return $this->assertTrue(strpos($this->_content, $raw) === FALSE, $message);
+  }
 
-        /**
-         *    Will trigger a pass if the Perl regex pattern
-         *    is not present in subject. Fail if found.
-         *    @param string $pattern    Perl regex to look for including
-         *                              the regex delimiters.
-         *    @param string $subject    String to search in.
-         *    @param string $message    Message to display.
-         *    @return boolean           True on pass
-         *    @access public
-         */
-        function assertNoUnwantedPattern($pattern, $subject, $message = "%s") {
-            return $this->assertExpectation(
-                    new UnwantedPatternExpectation($pattern),
-                    $subject,
-                    $message);
-        }
 
-        /**
-         *    Confirms that no errors have occurred so
-         *    far in the test method.
-         *    @param string $message    Message to display.
-         *    @return boolean           True on pass
-         *    @access public
-         */
-        function assertNoErrors($message = "%s") {
-            $queue = &SimpleErrorQueue::instance();
-            return $this->assertTrue(
-                    $queue->isEmpty(),
-                    sprintf($message, "Should be no errors"));
-        }
+  /**
+   *    Pass if the raw text IS found on the text version of the page.
+   *
+   *  @param string $raw
+   *    Text string to look for
+   *  @param string $message
+   *    Message to display.
+   *    @return
+   *    TRUE on pass
+   */
+  function assertText($text, $message) {
+    return $this->assertTextHelper($text, $message, FALSE);
+  }
 
-        /**
-         *    Confirms that an error has occurred and
-         *    optionally that the error text matches exactly.
-         *    @param string $expected   Expected error text or
-         *                              false for no check.
-         *    @param string $message    Message to display.
-         *    @return boolean           True on pass
-         *    @access public
-         */
-        function assertError($expected = false, $message = "%s") {
-            $queue = &SimpleErrorQueue::instance();
-            if ($queue->isEmpty()) {
-                $this->fail(sprintf($message, "Expected error not found"));
-                return;
-            }
-            list($severity, $content, $file, $line, $globals) = $queue->extract();
-            $severity = SimpleErrorQueue::getSeverityAsString($severity);
-            return $this->assertTrue(
-                    ! $expected || ($expected == $content),
-                    "Expected [$expected] in PHP error [$content] severity [$severity] in [$file] line [$line]");
-        }
+  /**
+   *  Pass if the raw text is NOT found on the text version of the page.
+   *
+   *  @param string $raw
+   *    Text string to look for
+   *  @param string $message
+   *    Message to display.
+   *    @return
+   *    TRUE on pass
+   */
+  function assertNoText($text, $message) {
+    return $this->assertTextHelper($text, $message, TRUE);
+  }
 
-        /**
-         *    Confirms that an error has occurred and
-         *    that the error text matches a Perl regular
-         *    expression.
-         *    @param string $pattern   Perl regular expression to
-         *                              match against.
-         *    @param string $message    Message to display.
-         *    @return boolean           True on pass
-         *    @access public
-         */
-        function assertErrorPattern($pattern, $message = "%s") {
-            $queue = &SimpleErrorQueue::instance();
-            if ($queue->isEmpty()) {
-                $this->fail(sprintf($message, "Expected error not found"));
-                return;
-            }
-            list($severity, $content, $file, $line, $globals) = $queue->extract();
-            $severity = SimpleErrorQueue::getSeverityAsString($severity);
-            return $this->assertTrue(
-                    (boolean)preg_match($pattern, $content),
-                    "Expected pattern match [$pattern] in PHP error [$content] severity [$severity] in [$file] line [$line]");
-        }
+  protected function assertTextHelper($text, $message, $not_exists) {
+    if ($this->plain_text === FALSE) {
+      $this->plain_text = filter_xss($this->_content, array());
+    }
+    return $this->assertTrue($not_exists == (strpos($this->plain_text, $text) === FALSE), $message);
+  }
 
+  /**
+   *  Pass if the page title is the given string.
+   *
+   *  @param $title
+   *    Text string to look for
+   *  @param $message
+   *    Message to display.
+   *  @return
+   *    TRUE on pass
+   */
+  function assertTitle($title, $message) {
+    $this->assertTrue($this->parse() && $this->elements->xpath('//title[text()="'. $title .'"]'), $message);
+  }
 
 }
-?>
Index: simpletest.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/simpletest.info,v
retrieving revision 1.5
diff -u -p -r1.5 simpletest.info
--- simpletest.info	21 Feb 2008 23:38:28 -0000	1.5
+++ simpletest.info	16 Mar 2008 19:24:38 -0000
@@ -2,4 +2,4 @@
 name = "SimpleTest module"
 description = "Provides simpletest classes to developers as well as some standard tests for Drupal"
 package = Simpletest
-core = 7.x
+core = 6.x
Index: simpletest.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/simpletest.module,v
retrieving revision 1.34
diff -u -p -r1.34 simpletest.module
--- simpletest.module	26 Feb 2008 19:13:57 -0000	1.34
+++ simpletest.module	16 Mar 2008 19:24:38 -0000
@@ -65,7 +65,7 @@ function simpletest_load() {
   }
   
   // We currently use only the web tester that DrupalTestCase is built upon
-  require_once(SIMPLE_TEST .'/web_tester.php');
+  require_once(SIMPLE_TEST .'/unit_tester.php');
   require_once(SIMPLE_TEST .'/reporter.php');
   require_once('drupal_reporter.php');
  
Index: tests/functional/comment.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/comment.test,v
retrieving revision 1.2
diff -u -p -r1.2 comment.test
--- tests/functional/comment.test	15 Mar 2008 20:34:33 -0000	1.2
+++ tests/functional/comment.test	16 Mar 2008 19:24:38 -0000
@@ -220,7 +220,7 @@ class CommentModuleTestCase extends Drup
 
     $match = array();
     // Get comment ID
-    preg_match('/#comment-([^"]+)/', $this->_browser->getURL(), $match);
+    preg_match('/#comment-([^"]+)/', $this->getURL(), $match);
     
     // get comment
     if ($contact !== TRUE) { // If true then attempting to find error message.
Index: tests/functional/forum.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/forum.test,v
retrieving revision 1.2
diff -u -p -r1.2 forum.test
--- tests/functional/forum.test	15 Mar 2008 20:34:33 -0000	1.2
+++ tests/functional/forum.test	16 Mar 2008 19:24:38 -0000
@@ -174,7 +174,7 @@ class AddTopicToForum extends DrupalForu
     $web_user = $this->drupalCreateUserRolePerm(array(
       'access administration pages',
       'administer forums',
-      'create forum topics'
+      'create forum content'
     ));
     $this->drupalLoginUser($web_user);
 
@@ -185,7 +185,7 @@ class AddTopicToForum extends DrupalForu
     // Generate a random subject/body
     $title = $this->randomName(20);
     $description = $this->randomName(200);
- 
+
     $edit = array(
       'title' => $title,
       'body' => $description
@@ -217,7 +217,7 @@ class AddTopicToForum extends DrupalForu
     $web_user = $this->drupalCreateUserRolePerm(array(
       'access administration pages',
       'administer forums',
-      'create forum topics'
+      'create forum content'
     ));
     $this->drupalLoginUser($web_user);
 
@@ -254,8 +254,8 @@ class AddTopicToForum extends DrupalForu
     $web_user = $this->drupalCreateUserRolePerm(array(
       'access administration pages',
       'administer forums',
-      'create forum topics',
-      'edit any forum topic'
+      'create forum content',
+      'edit any forum content'
     ));
     $this->drupalLoginUser($web_user);
 
@@ -311,8 +311,8 @@ class AddTopicToForum extends DrupalForu
     $web_user = $this->drupalCreateUserRolePerm(array(
       'access administration pages',
       'administer forums',
-      'create forum topics',
-      'edit any forum topic'
+      'create forum content',
+      'edit any forum content'
     ));
     $this->drupalLoginUser($web_user);
 
Index: tests/functional/poll.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/poll.test,v
retrieving revision 1.2
diff -u -p -r1.2 poll.test
--- tests/functional/poll.test	15 Mar 2008 20:34:33 -0000	1.2
+++ tests/functional/poll.test	16 Mar 2008 19:24:38 -0000
@@ -40,14 +40,14 @@ class PollTests extends DrupalTestCase {
 }
 
 class PollCreateTest extends PollTests {
-  
+
   /**
    * Implementation of get_info() for information
    */
   function get_info() {
     return array('name' => t('Poll create'), 'desc' => 'Adds "more choices", previews and creates a poll.', 'group' => 'Poll module tests');
   }
-  
+
   function setUp() {
     parent::setUp();
     $this->drupalModuleEnable('poll');
@@ -65,7 +65,7 @@ class PollVoteTest extends PollTests {
   function get_info() {
     return array('name' => t('Poll vote'), 'desc' => 'Vote on a poll', 'group' => 'Poll module tests');
   }
-    
+
   function setUp() {
     parent::setUp();
     $this->drupalModuleEnable('poll');
Index: tests/functional/profile.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/profile.test,v
retrieving revision 1.2
diff -u -p -r1.2 profile.test
--- tests/functional/profile.test	15 Mar 2008 20:34:33 -0000	1.2
+++ tests/functional/profile.test	16 Mar 2008 19:24:39 -0000
@@ -75,7 +75,7 @@ class ProfileModuleTestSingle extends Dr
     $single_field = array('title' => $title, 'form_name' => $form_name, 'explanation' => $explanation);
 
     // checking simple fields
-    $this->_browser->get(url("user/". $user->uid. "/edit/$my_category"));
+    $this->drupalGet("user/". $user->uid. "/edit/$my_category");
 
     // checking field
     $this->assertField($form_name , '');
@@ -90,7 +90,7 @@ class ProfileModuleTestSingle extends Dr
     $checking = array();
     $edit[$form_name] = $this->randomName(20);
     $this->drupalPost("user/". $user->uid. "/edit/$my_category", $edit, 'Save' , 0);
-    $this->_browser->get(url("user/". $user->uid));
+    $this->drupalGet("user/". $user->uid);
 
     // checking profile page
     $this->assertWantedText($edit[$form_name], "Checking ". $edit[$form_name]);
@@ -98,11 +98,11 @@ class ProfileModuleTestSingle extends Dr
     // update field
     $new_title = $this->randomName(20);
     $this->drupalPost("admin/user/profile/edit/$fid", array('title' => $new_title), 'Save field' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertWantedText($new_title, "Checking updated field");
     // deleting field
     $this->drupalPost("admin/user/profile/delete/$fid", array(), 'Delete' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertNoUnwantedText($new_title, "Checking deleted field $title");
 
     // delete test user and roles
@@ -189,7 +189,7 @@ class ProfileModuleTestTextarea extends 
     $single_field = array('title' => $title, 'form_name' => $form_name, 'explanation' => $explanation);
 
     // checking simple fields
-    $this->_browser->get(url("user/". $user->uid. "/edit/$my_category"));
+    $this->drupalGet("user/". $user->uid. "/edit/$my_category");
 
     // checking field
     $this->assertField($form_name, '');
@@ -204,7 +204,7 @@ class ProfileModuleTestTextarea extends 
     $checking = array();
     $edit[$form_name] = $this->randomName(20);
     $this->drupalPost("user/". $user->uid. "/edit/$my_category", $edit, 'Save' , 0);
-    $this->_browser->get(url("user/". $user->uid));
+    $this->drupalGet("user/". $user->uid);
 
     // checking profile page
     $this->assertWantedText($edit[$form_name], "Checking ". $edit[$form_name]);
@@ -212,11 +212,11 @@ class ProfileModuleTestTextarea extends 
     // update field
     $new_title = $this->randomName(20);
     $this->drupalPost("admin/user/profile/edit/$fid", array('title' => $new_title), 'Save field' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertWantedText($new_title, "Checking updated field");
     // deleting field
     $this->drupalPost("admin/user/profile/delete/$fid", array(), 'Delete' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertNoUnwantedText($new_title, "Checking deleted field $title");
 
     // delete test user and roles
@@ -303,7 +303,7 @@ class ProfileModuleTestFreelist extends 
     $single_field = array('title' => $title, 'form_name' => $form_name, 'explanation' => $explanation);
 
     // checking simple fields
-    $this->_browser->get(url("user/". $user->uid. "/edit/$my_category"));
+    $this->drupalGet("user/". $user->uid. "/edit/$my_category");
 
     // checking field
     $this->assertField($form_name, '');
@@ -318,7 +318,7 @@ class ProfileModuleTestFreelist extends 
     $checking = array();
     $edit[$form_name] = $this->randomName(20);
     $this->drupalPost("user/". $user->uid. "/edit/$my_category", $edit, 'Save' , 0);
-    $this->_browser->get(url("user/". $user->uid));
+    $this->drupalGet("user/". $user->uid);
 
     // checking profile page
     $this->assertWantedText($edit[$form_name], "Checking ". $edit[$form_name]);
@@ -326,11 +326,11 @@ class ProfileModuleTestFreelist extends 
     // update field
     $new_title = $this->randomName(20);
     $this->drupalPost("admin/user/profile/edit/$fid", array('title' => $new_title), 'Save field' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertWantedText($new_title, "Checking updated field");
     // deleting field
     $this->drupalPost("admin/user/profile/delete/$fid", array(), 'Delete' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertNoUnwantedText($new_title, "Checking deleted field $title");
 
     // delete test user and roles
@@ -418,7 +418,7 @@ class ProfileModuleTestCheckbox extends 
     $single_field = array('title' => $title, 'form_name' => $form_name, 'explanation' => $explanation);
 
     // checking simple fields
-    $this->_browser->get(url("user/". $user->uid. "/edit/$my_category"));
+    $this->drupalGet("user/". $user->uid. "/edit/$my_category");
 
     // checking field
     $this->assertField($form_name, false);
@@ -433,18 +433,18 @@ class ProfileModuleTestCheckbox extends 
     $checking = array();
     $edit[$form_name] = 1;
     $this->drupalPost("user/". $user->uid. "/edit/$my_category", $edit, 'Save' , 0);
-    $this->_browser->get(url("user/". $user->uid));
+    $this->drupalGet("user/". $user->uid);
     // checking profile page
     $this->assertWantedText($title, "Checking checkbox");
     $this->assertWantedText($title, "Checking $title");
     // update field
     $new_title = $this->randomName(10);
     $this->drupalPost("admin/user/profile/edit/$fid", array('title' => $new_title), 'Save field' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertWantedText($new_title, "Checking updated field");
     // deleting field
     $this->drupalPost("admin/user/profile/delete/$fid", array(), 'Delete' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertNoUnwantedText($new_title, "Checking deleted field $title");
 
     // delete test user and roles
@@ -527,11 +527,11 @@ class ProfileModuleTestUrl extends Drupa
     $explanation = $this->randomName(50);
     $edit = array('category' => $my_category, 'title' => $title, 'name' => $form_name, 'explanation' => $explanation);
     $this->drupalPost("admin/user/profile/add/url", $edit, 'Save field' , 0);
-    $fid = db_result(db_query('SELECT fid FROM {profile_fields} WHERE title = "%s"', $title));
+    $fid = db_query('SELECT fid FROM {profile_fields} WHERE title = :title', array(':title' => $title))->fetchOne();
     $single_field = array('title' => $title, 'form_name' => $form_name, 'explanation' => $explanation);
 
     // checking simple fields
-    $this->_browser->get(url("user/". $user->uid. "/edit/$my_category"));
+    $this->drupalGet("user/". $user->uid. "/edit/$my_category");
 
     // checking field
     $this->assertField($form_name, '');
@@ -546,7 +546,7 @@ class ProfileModuleTestUrl extends Drupa
     $checking = array();
     $edit[$form_name] = 'http://www.' . $this->randomName(10). '.org';
     $this->drupalPost("user/". $user->uid. "/edit/$my_category", $edit, 'Save' , 0);
-    $this->_browser->get(url("user/". $user->uid));
+    $this->drupalGet("user/". $user->uid);
 
     // checking profile page
     $this->assertWantedText($edit[$form_name], "Checking ". $edit[$form_name]);
@@ -554,11 +554,11 @@ class ProfileModuleTestUrl extends Drupa
     // update field
     $new_title = $this->randomName(20);
     $this->drupalPost("admin/user/profile/edit/$fid", array('title' => $new_title), 'Save field' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertWantedText($new_title, "Checking updated field");
     // deleting field
     $this->drupalPost("admin/user/profile/delete/$fid", array(), 'Delete' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertNoUnwantedText($new_title, "Checking deleted field $title");
 
     // delete test user and roles
@@ -644,11 +644,11 @@ class ProfileModuleTestSelection extends
       $options .= $this->randomName(8) . "\n";
     $edit = array('category' => $my_category, 'title' => $title, 'name' => $form_name, 'explanation' => $explanation, 'options' => $options);
     $this->drupalPost("admin/user/profile/add/selection", $edit, 'Save field' , 0);
-    $fid = db_result(db_query('SELECT fid FROM {profile_fields} WHERE title = "%s"', $title));
+    $fid = db_query('SELECT fid FROM {profile_fields} WHERE title = :title', array(':title' => $title))->fetchOne();
     $single_field = array('title' => $title, 'form_name' => $form_name, 'explanation' => $explanation);
 
     // checking simple fields
-    $this->_browser->get(url("user/". $user->uid. "/edit/$my_category"));
+    $this->drupalGet("user/". $user->uid. "/edit/$my_category");
     // checking name
     $this->assertWantedText($title, "Checking title for ". $title);
     // checking explanation
@@ -669,7 +669,7 @@ class ProfileModuleTestSelection extends
     $key = $form_name;
     $edit[$key] = rtrim($op_tab[$element]);
     $this->drupalPost("user/". $user->uid. "/edit/$my_category", $edit, 'Save' , 0);
-    $this->_browser->get(url("user/". $user->uid));
+    $this->drupalGet("user/". $user->uid);
 
     // checking profile page
     $this->assertWantedText($edit[$form_name], "Checking ". $edit[$form_name]);
@@ -677,11 +677,11 @@ class ProfileModuleTestSelection extends
     // update field
     $new_title = $this->randomName(20);
     $this->drupalPost("admin/user/profile/edit/$fid", array('title' => $new_title), 'Save field' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertWantedText($new_title, "Checking updated field");
     // deleting field
     $this->drupalPost("admin/user/profile/delete/$fid", array(), 'Delete' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertNoUnwantedText($new_title, "Checking deleted field $title");
 
     // delete test user and roles
@@ -769,11 +769,11 @@ class ProfileModuleTestDate extends Drup
       $options .= $this->randomName(8) . "\n";*/
     $edit = array('category' => $my_category, 'title' => $title, 'name' => $form_name, 'explanation' => $explanation);
     $this->drupalPost("admin/user/profile/add/date", $edit, 'Save field' , 0);
-    $fid = db_result(db_query('SELECT fid FROM {profile_fields} WHERE title = "%s"', $title));
+    $fid = db_query('SELECT fid FROM {profile_fields} WHERE title = :title', array(':title' => $title))->fetchOne();
     $single_field = array('title' => $title, 'form_name' => $form_name, 'explanation' => $explanation);
 
     // checking simple fields
-    $this->_browser->get(url("user/". $user->uid. "/edit/$my_category"));
+    $this->drupalGet("user/". $user->uid. "/edit/$my_category");
     // checking name
     $this->assertWantedText($title, "Checking title for ". $title);
     // checking explanation
@@ -798,7 +798,7 @@ class ProfileModuleTestDate extends Drup
                        'Y' => 1983);
     $data = strtr($format, $replace);
     $this->drupalPost("user/". $user->uid. "/edit/$my_category", $edit, 'Save' , 0);
-    $this->_browser->get(url("user/". $user->uid));
+    $this->drupalGet("user/". $user->uid);
 
     // checking profile page
     $this->assertWantedText($data, "Checking date $data");
@@ -806,11 +806,11 @@ class ProfileModuleTestDate extends Drup
     // update field
     $new_title = $this->randomName(20);
     $this->drupalPost("admin/user/profile/edit/$fid", array('title' => $new_title), 'Save field' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertWantedText($new_title, "Checking updated field");
     // deleting field
     $this->drupalPost("admin/user/profile/delete/$fid", array(), 'Delete' , 0);
-    $this->_browser->get(url("admin/user/profile"));
+    $this->drupalGet("admin/user/profile");
     $this->assertNoUnwantedText($new_title, "Checking deleted field $title");
 
     // delete test user and roles
@@ -908,8 +908,8 @@ class ProfileModuleTest2 extends DrupalT
     $fid = db_result(db_query('SELECT fid FROM {profile_fields} WHERE title = "%s"', $title));
     $sfield2 = array('fid'=> $fid, 'title' => $title);
     // checking
-    $this->_browser->get(url("user/". $user->uid. "/edit/$my_category"));
-    $content = $this->_browser->getContent();
+    $this->drupalGet("user/". $user->uid. "/edit/$my_category");
+    $content = $this->drupalGetContent();
     $pos1 = strpos($content, $sfield1['title']);
     $pos2 = strpos($content, $sfield2['title']);
     $this->assertTrue($pos2 < $pos1, 'Checking weight field');
@@ -918,8 +918,8 @@ class ProfileModuleTest2 extends DrupalT
     $delete_fields[] = $sfield2['fid'];
     // check if this field is visible in registration form
     // logout
-    $this->_browser->get(url("logout"));
-    $this->_browser->get(url("user/register"));
+    $this->drupalGet("logout");
+    $this->drupalGet("user/register");
     $this->assertNoUnwantedText($sfield1['title'], 'Field is not visible in registration form');
     $this->assertWantedText($sfield2['title'], 'Field is visible in registration form');
     // try to register
@@ -948,7 +948,7 @@ class ProfileModuleTest2 extends DrupalT
     $op_tab = explode("\n", $options,3);
     $choice = rtrim($op_tab[$element]);
     // checking
-    $this->_browser->get(url("profile/". $form_name. "/$choice"));
+    $this->drupalGet("profile/". $form_name. "/$choice");
     $title = str_replace("%value", $choice, $page_title);
 
     $this->assertTitle($title. ' | '. variable_get('site_name', 'Drupal'), "Checking title $title");
Index: tests/functional/system.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/system.test,v
retrieving revision 1.2
diff -u -p -r1.2 system.test
--- tests/functional/system.test	15 Mar 2008 20:34:33 -0000	1.2
+++ tests/functional/system.test	16 Mar 2008 19:24:39 -0000
@@ -39,7 +39,7 @@ class EnableCoreModuleTest extends Drupa
       'translation',
       'trigger',
       'update',
-      'upload',       	
+      'upload',
     );
 
     // Get a list of the currently enabled modules
@@ -59,14 +59,14 @@ class EnableCoreModuleTest extends Drupa
 
       $edit['status['. $module .']'] = $module;
     }
-
+
     $this->drupalPost('admin/build/modules/list/confirm', $edit, 'Save configuration');
     $this->assertWantedRaw(t('The configuration options have been saved.'), t('Ensure that the module status has been updated'));
 
     // Now, we check the tables for each module
     // We also refresh the module list and make sure the modules are enabled
     module_list(true, false);
-    foreach ($modules_to_enable as $module) {
+    foreach ($modules_to_enable as $module) {
       $cur_schema = drupal_get_schema_unprocessed($module);
 
       $tables = is_array($cur_schema) ? array_keys($cur_schema) : array();
@@ -88,7 +88,7 @@ class EnableCoreModuleTest extends Drupa
       }
     }
 
-    drupal_clear_css_cache();
+    drupal_clear_css_cache();
     drupal_clear_js_cache();
   }
 }
@@ -166,7 +166,7 @@ class DisableUninstallCoreModuleTest ext
       'translation',
       'trigger',
       'update',
-      'upload',           
+      'upload',
     );
 
     // Get a list of the currently enabled modules
@@ -213,14 +213,14 @@ class DisableUninstallCoreModuleTest ext
       if (module_hook($module, 'uninstall'))
         $edit['uninstall['. $module .']'] = $module;
     }
-
+
     $this->drupalPost('admin/build/modules/uninstall/confirm', $edit, 'Uninstall');
     // We need to confirm this by clicking again
-    $this->_browser->clickSubmit(t('Uninstall'));
+    $this->drupalPost(NULL, array(), t('Uninstall'));
     $this->assertWantedRaw(t('The selected modules have been uninstalled.'), 'Check to ensure that the modules have been removed');
 
     // Now, we check the tables for each module
-    foreach ($modules_to_test as $module) {
+    foreach ($modules_to_test as $module) {
       $cur_schema = drupal_get_schema_unprocessed($module);
 
       $tables = is_array($cur_schema) ? array_keys($cur_schema) : array();
@@ -228,7 +228,7 @@ class DisableUninstallCoreModuleTest ext
         $this->assertFalse(db_table_exists($table), t('Ensure that the database table has been properly removed'));
     }
 
-    drupal_clear_css_cache();
+    drupal_clear_css_cache();
     drupal_clear_js_cache();
   }
 }
Index: tests/functional/taxonomy.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/taxonomy.test,v
retrieving revision 1.2
diff -u -p -r1.2 taxonomy.test
--- tests/functional/taxonomy.test	15 Mar 2008 20:34:33 -0000	1.2
+++ tests/functional/taxonomy.test	16 Mar 2008 19:24:39 -0000
@@ -285,12 +285,6 @@ class TaxonomyTestNodeApi extends Drupal
     // why is this printing out the user profile page?
     // go to node/add/story
     $this->drupalGet('node/add/story');
-    $req = $this->_browser->getRequest();
-
-    $headers = $this->_browser->getHeaders();
-
-    $content = $this->drupalGetContent();
-//    print($content). "\n\n\n all done \n\n";
 
     // try to create story
     $title = $this->randomName();
@@ -301,14 +295,13 @@ class TaxonomyTestNodeApi extends Drupal
     // Failing because they were being sent/handled wrong (earnest.berry@gmail.com <Souvent22>)
     $action = url('node/add/story', array('absolute' => TRUE));
     $this->drupalPost($action, $edit, 'Save');
-    $content = $this->drupalGetContent();
     $patternArray['body text'] = $body;
     $patternArray['title'] = $title;
 
 //    $node = array2object(node_load(array('title' => $title)));
     $node = node_load(array('title' => $title));
     
-    $this->_browser->get(url("node/$node->nid"));
+    $this->drupalGet("node/$node->nid");
     foreach($patternArray as $name => $termPattern) {
       $this->assertText($termPattern, "Checking $name");
     }
@@ -358,7 +351,7 @@ class TaxonomyTestNodeApi extends Drupal
     // delete node through browser
     $this->drupalPost('node/'. $node->nid .'/delete', array(), 'Delete' );
     // checking after delete
-    $this->_browser->get(url("node/".$node->nid));
+    $this->drupalGet("node/".$node->nid);
     $this->assertNoUnwantedText($termname, "Checking if node exists");
     // checking database fields
     $num_rows = db_result(db_query('SELECT COUNT(*) FROM {term_node} WHERE nid = %d', $node->nid));
Index: tests/functional/translation.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/translation.test,v
retrieving revision 1.1
diff -u -p -r1.1 translation.test
--- tests/functional/translation.test	15 Mar 2008 20:26:32 -0000	1.1
+++ tests/functional/translation.test	16 Mar 2008 19:24:39 -0000
@@ -32,7 +32,7 @@ class TranslationModuleTestCase extends 
     $this->add_language('es');
     
     // Set story content type to use multilingual support with translation.
-    $this->drupalPost('admin/content/types/story', array('language_content_type' => "2"), 'Save content type');
+    $this->drupalPost('admin/content/node-type/story', array('language_content_type' => "2"), 'Save content type');
     $this->assertWantedRaw(t('The content type %type has been updated.', array('%type' => 'Story')), 'Story content type has been updated.');
 
     $this->drupalGet('logout');
Index: tests/functional/upload.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/upload.test,v
retrieving revision 1.3
diff -u -p -r1.3 upload.test
--- tests/functional/upload.test	15 Mar 2008 22:58:01 -0000	1.3
+++ tests/functional/upload.test	16 Mar 2008 19:24:39 -0000
@@ -210,8 +210,7 @@ class UploadPictureTests extends DrupalT
         $picture = file_create_url($pic_path);
 
         // check if image is displayed in user's profile page
-        $content = $this->_browser->getContent();
-        $this->assertTrue(strpos($content,$picture), "Image is displayed in user's profile page");
+        $this->assertWantedRaw($picture, "Image is displayed in user's profile page");
 
         // check if file is located in proper directory
         $this->assertTrue(is_file($pic_path), "File is located in proper directory");
@@ -267,8 +266,7 @@ class UploadPictureTests extends DrupalT
         $picture = file_create_url($pic_path);
 
         // check if image is displayed in user's profile page
-        $content = $this->_browser->getContent();
-        $this->assertTrue(strpos($content,$picture), "Image is displayed in user's profile page");
+        $this->assertWantedRaw($picture, "Image is displayed in user's profile page");
 
         // check if file is located in proper directory
         $this->assertTrue(is_file($pic_path), "File is located in proper directory");
Index: tests/functional/user.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/user.test,v
retrieving revision 1.2
diff -u -p -r1.2 user.test
--- tests/functional/user.test	15 Mar 2008 20:34:33 -0000	1.2
+++ tests/functional/user.test	16 Mar 2008 19:24:39 -0000
@@ -57,20 +57,22 @@ class UserRegistrationTest extends Drupa
     $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);
-    $this->_browser->get($url);
+    $this->drupalGet($url);
 
     // 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->_browser->clickSubmit(t('Log in'));
+    $this->drupalPost(NULL, array(), 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.");
 
     /* now lets change our password */
     $new_pass = user_password();
-    $this->assertTrue($this->_browser->setField('pass[pass1]', $new_pass), 'Pass1 field set.');
-    $this->assertTrue($this->_browser->setField('pass[pass2]', $new_pass), 'Pass2 field set.');
-    $this->_browser->clickSubmit(t('Save'));
+    $edit = array(
+      'pass[pass1]' => $new_pass,
+      'pass[pass2]' => $new_pass,
+    );
+    $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertText(t('The changes have been saved.'), "Changed password to '$new_pass'");
 
     /* Check if the password changes are present in db */
@@ -94,7 +96,7 @@ class UserRegistrationTest extends Drupa
     $this->assertNoUnwantedRaw(t('The username %name has been blocked.', array('%name' => $pname)), 'Not blocked');
     $this->assertNoUnwantedRaw(t('The name %name is a reserved username.', array('%name' => $pname)), 'Access granted');
 
-    $this->_browser->get(url('user'), array('absolute' => TRUE));
+    $this->drupalGet(url('user'), array('absolute' => TRUE));
     $this->assertText($pname, 'user as auth lands on the user profile');
     $this->assertText(t('View'), 'View tab on the profile page');
     $this->assertText(t('Edit'), 'Edit tab on the profile page');
@@ -197,15 +199,14 @@ class UserAccessTest extends DrupalTestC
     $this->assertNoUnWantedText(t('Your password and further instructions have been sent to your e-mail address.'), 'blocked user: Your password and further instructions - not found');
     $this->assertText(t('The name @name has been denied access.', array('@name' => $name)), 'blocked user: denied access - found');
 
-    /* Lets make a new browser for new cookies */
-    $this->setBrowser($this->createBrowser());
-
     /* now try allowed user */
     $name = $this->randomName(2, 'simpletest_block_allow_');
     $mail = "$name@example.com";
     $edit = array('name' => $name,
                   'mail' => $mail);
 
+    /* We need new cookies */
+    unset($this->ch);
     $this->drupalPost('user/register', $edit, 'Create new account');
 
     $this->assertText(t('Your password and further instructions have been sent to your e-mail address.'), 'access user: Your password and further instructions - found');
@@ -250,11 +251,11 @@ class UserDeleteTest extends DrupalTestC
     $uid = $user_to_delete->uid;
     $web_user = $this->drupalCreateUserRolePerm(array('administer users'));
     $this->drupalLoginUser($web_user);
-    $this->_browser->get(url('user/'. $uid .'/edit', array('absolute' => TRUE)));
-    $this->_browser->clickSubmit(t('Delete'));
+    $this->drupalGet(url('user/'. $uid .'/edit', array('absolute' => TRUE)));
+    $this->drupalPost(NULL, array(), t('Delete'));
     $this->assertWantedRaw(t('Are you sure you want to delete the account %name?', array('%name' => $name)), 'Confirm title');
     $this->assertText(t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'), 'Confirm text');
-    $this->_browser->clickSubmit(t('Delete'));
+    $this->drupalPost(NULL, array(), t('Delete'));
     $this->assertWantedRaw(t('%name has been deleted.', array('%name' => $name)), 'User deleted');
     $this->assertFalse(user_load($edit), 'User is not found in the database');
   }
