### Eclipse Workspace Patch 1.0
#P dh
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.47
diff -u -r1.47 common.test
--- modules/simpletest/tests/common.test	30 Jun 2009 09:39:19 -0000	1.47
+++ modules/simpletest/tests/common.test	30 Jun 2009 18:22:57 -0000
@@ -9,7 +9,7 @@
   public static function getInfo() {
     return array(
       'name' => t('Tests for the l() function'),
-      'description' => t('Confirm that url() works correctly with various input.'),
+      'description' => t('Confirm that l() and url() work correctly with various input.'),
       'group' => t('System'),
     );
   }
@@ -24,6 +24,28 @@
     $sanitized_path = check_url(url($path));
     $this->assertTrue(strpos($link, $sanitized_path) != FALSE, t('XSS attack @path was filtered', array('@path' => $path)));
   }
+  
+  /**
+   * Tests for active class in l() function.
+   */
+  function testLActiveClass() {
+    $link = l($this->randomName(), $_GET['q']);
+    $this->assertTrue($this->hasClass($link, 'active'), t('Class @class is present on link to the current page', array('@class' => 'active')));
+  }
+
+  /**
+   * Tests for custom class in l() function.
+   */
+  function testLCustomClass() {
+    $class = $this->randomName();
+    $link = l($this->randomName(), $_GET['q'], array('attributes' => array('class' => $class)));
+    $this->assertTrue($this->hasClass($link, $class), t('Custom class @class is present on link when requested', array('@class' => $class)));
+  }
+  
+  private function hasClass($link, $class) {
+    return preg_match('|class=.*[\"\'\s]' . $class . '[\"\'\s]|i', $link);
+  }
+  
 }
 
 class CommonSizeTestCase extends DrupalUnitTestCase {
