Merge pull request #13872 from seamuslee001/composer_2_0_compatability
[civicrm-core.git] / tests / phpunit / CiviTest / CiviUnitTestCase.php
index 14e252f4dafce745d2e12f72aad2403419dfc97a..08762b0ca6a9614b916207dc4d8f060af026b143 100644 (file)
@@ -336,6 +336,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     //flush component settings
     CRM_Core_Component::getEnabledComponents(TRUE);
 
+    $_REQUEST = $_GET = $_POST = [];
     error_reporting(E_ALL);
 
     $this->_sethtmlGlobals();
@@ -412,8 +413,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     if ($this->hookClass) {
       $this->hookClass->reset();
     }
-    $session = CRM_Core_Session::singleton();
-    $session->set('userID', NULL);
+    CRM_Core_Session::singleton()->reset(1);
 
     if ($this->tx) {
       $this->tx->rollback()->commit();
@@ -1981,6 +1981,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
       'defaultValue' => 'Default Value',
       'lowercasevalue' => 'Lowercase Value',
       1 => 'Integer Value',
+      'NULL' => 'NULL',
     ];
     $custom_field_params = ['sequential' => 1, 'id' => $customField['id']];
     $custom_field_api_result = $this->callAPISuccess('custom_field', 'get', $custom_field_params);
@@ -3395,13 +3396,13 @@ AND    ( TABLE_NAME LIKE 'civicrm_value_%' )
       ),
       $params
     );
-    $newPaymentInstrument = $this->callAPISuccess('OptionValue', 'create', $params);
+    $newPaymentInstrument = $this->callAPISuccess('OptionValue', 'create', $params)['id'];
 
     $relationTypeID = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
 
     $financialAccountParams = [
       'entity_table' => 'civicrm_option_value',
-      'entity_id' => key($newPaymentInstrument),
+      'entity_id' => $newPaymentInstrument,
       'account_relationship' => $relationTypeID,
       'financial_account_id' => $this->callAPISuccess('FinancialAccount', 'getValue', ['name' => $financialAccountName, 'return' => 'id']),
     ];