Add test for CRM_Utils_Array::remove
authorColeman Watts <coleman@civicrm.org>
Tue, 18 Nov 2014 18:20:13 +0000 (13:20 -0500)
committerColeman Watts <coleman@civicrm.org>
Tue, 18 Nov 2014 18:20:13 +0000 (13:20 -0500)
tests/phpunit/CRM/Utils/ArrayTest.php

index ced61fc279842ce59e207b55b4e025f9e19efc5d..0ae70b9594fe46bad1d6d5962cadd2fddaaa48d7 100644 (file)
@@ -6,17 +6,6 @@ require_once 'CiviTest/CiviUnitTestCase.php';
  */
 class CRM_Utils_ArrayTest extends CiviUnitTestCase {
 
-  /**
-   * @return null
-   */
-  private function &returnByReference() {
-    static $foo;
-    if ($foo === NULL) {
-      $foo['foo'] = 'original';
-    }
-    return $foo;
-  }
-
   function testIndexArray() {
     $inputs = array();
     $inputs[] = array(
@@ -124,4 +113,17 @@ class CRM_Utils_ArrayTest extends CiviUnitTestCase {
     $this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array('b')));
     $this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array('b','c','d')));
   }
+
+  function testRemove() {
+    $data = array(
+      'one' => 1,
+      'two' => 2,
+      'three' => 3,
+      'four' => 4,
+      'five' => 5,
+      'six' => 6,
+    );
+    CRM_Utils_Array::remove($data, 'one', 'two', array('three', 'four'), 'five');
+    $this->assertEquals($data, array('six' => 6));
+  }
 }