Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.7
diff -u -p -r1.7 common.test
--- modules/simpletest/tests/common.test	17 Sep 2008 07:01:31 -0000	1.7
+++ modules/simpletest/tests/common.test	16 Oct 2008 13:00:47 -0000
@@ -251,3 +251,85 @@ class DrupalSetContentTestCase extends D
     }
   }
 }
+
+/**
+ * Testing url creation.
+ */
+class DrupalUrlCreationTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Drupal url creation'),
+      'description' => t("Performs tests on creating urls through the url() function."),
+      'group' => t('System')
+    );
+  }
+
+  function setUp() {
+    // Set the default base_url and base_path so we can assert on a string.
+  	 $GLOBALS['base_url'] = 'http://foo';
+  	 $GLOBALS['base_path'] = '';
+
+  	 // Setup clean url settings directly because some servers do not use rewrite.
+    $GLOBALS['conf']['clean_url'] = 0;
+    
+    // We do not want to test the script version
+    $_SERVER['SERVER_SOFTWARE'] = 'Apache';
+  }
+
+  function testExternalUrl() {
+  	$this->assertTrue(url('http://drupal.org') == 'http://drupal.org', t('Creation of external url.'));
+  	$this->assertTrue(url('http://drupal.org#foo') == 'http://drupal.org#foo', t('Creation of external url with fragment in path.'));
+  	$this->assertTrue(url('http://drupal.org', array('fragment' => 'foo')) == 'http://drupal.org#foo', t('Creation of external url with fragment option.'));
+  	$this->assertTrue(url('http://drupal.org', array('query' => 'foo')) == 'http://drupal.org?foo', t('Creation of external url with query option.'));
+  	$this->assertTrue(url('http://drupal.org', array('query' => 'foo', 'fragment' => 'bar')) == 'http://drupal.org?foo#bar', t('Creation of external url with query and fragment option.'));
+  }
+
+  function testInternalUrl() {
+  	$this->assertTrue(url('node') == '?q=node', t('Creation of internal url.'));
+
+  	// Check internal url with base_path.
+  	$GLOBALS['base_path'] = '/foo/';
+  	$this->assertTrue(url('node') == '/foo/?q=node', t('Creation of internal url with base_path.'));
+  	$GLOBALS['base_path'] = '';
+  }
+}
+
+/**
+ * Testing clean url creation.
+ */
+class DrupalCleanUrlCreationTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Drupal clean url creation'),
+      'description' => t("Performs tests on creating clean urls through the url() function."),
+      'group' => t('System')
+    );
+  }
+
+  function setUp() {
+    // Set the default base_url and base_path so we can assert on a string.
+  	 $GLOBALS['base_url'] = 'http://foo';
+  	 $GLOBALS['base_path'] = '';
+
+    // Setup clean url settings directly because some servers do not use rewrite.
+    $GLOBALS['conf']['clean_url'] = 1;
+    
+    // We do not want to test the script version
+    $_SERVER['SERVER_SOFTWARE'] = 'Apache';
+  }
+
+  function testInternalUrl() {
+  	$this->assertTrue(url('node') == 'node', t('Creation of internal clean url.') . url('node'));
+
+  	// Check internal url with base_path.
+  	$GLOBALS['base_path'] = '/foo/';
+  	$this->assertTrue(url('node') == '/foo/node', t('Creation of internal clean url with base_path.'));
+  	$GLOBALS['base_path'] = '';
+  }
+}
