config->countryLimit - Don't directly modify array
authorTim Otten <totten@civicrm.org>
Sat, 12 Sep 2015 20:58:37 +0000 (13:58 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 17 Sep 2015 22:49:30 +0000 (15:49 -0700)
When using magic method for countryLimit, it's difficult to directly modify
the array.  It's easier to replace the array as a whole.

tests/phpunit/api/v3/ProfileTest.php

index 75542efb4d91729340d8fcfa2844259554c33cd3..4c6e2913e6ce16ddad2fdb9493e28fb52e053429 100644 (file)
@@ -45,8 +45,10 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     $this->_apiversion = 3;
     parent::setUp();
     $config = CRM_Core_Config::singleton();
-    $config->countryLimit[1] = 1013;
-    $config->stateLimit[1] = 1013;
+    $countryLimit = $config->countryLimit;
+    $countryLimit[1] = 1013;
+    $config->countryLimit = $countryLimit;
+
     $this->createLoggedInUser();
     $this->_membershipTypeID = $this->membershipTypeCreate();
   }