*/
private static $batch;
- /**
- * Get values of CiviContribute Settings
- * @var array
- */
- private static $contributeSettings;
-
/**
* DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
*
return self::$batch;
}
- /**
- * Get values of CiviContribute Settings
- * and check if its enabled or not
- *
- *
- * @param string $name
- * @return string
- *
- */
- public static function checkContributeSettings($name = NULL) {
- if (empty(self::$contributeSettings)) {
- self::$contributeSettings = Civi::settings()->get('contribution_invoice_settings');
- }
-
- if ($name) {
- return CRM_Utils_Array::value($name, self::$contributeSettings);
- }
- return self::$contributeSettings;
- }
-
}
$this->assertEquals("$ 200.00 - STUDENT", $activity->subject, 'Check for total amount in activity.');
}
+ /**
+ * Test checkContributeSettings.
+ */
+ public function testCheckContributeSettings() {
+ $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled');
+ $this->assertNull($settings);
+ $params = array(
+ 'contribution_invoice_settings' => array(
+ 'deferred_revenue_enabled' => '1',
+ ),
+ );
+ $this->callAPISuccess('Setting', 'create', $params);
+ $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled');
+ $this->assertEquals($settings, 1, 'Check for settings has failed');
+ }
+
}
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
- */
-
-/**
- * Tests for pseudoconstant retrieval
- * @group headless
- */
-class CRM_Contribute_PseudoConstantTest extends CiviUnitTestCase {
-
- public function setUp() {
- parent::setUp();
- }
-
- /**
- * Test checkContributeSettings.
- */
- public function testCheckContributeSettings() {
- $settings = CRM_Contribute_PseudoConstant::checkContributeSettings('deferred_revenue_enabled');
- $this->assertNull($settings);
- CRM_Contribute_PseudoConstant::flush('contributeSettings');
- $params = array(
- 'contribution_invoice_settings' => array(
- 'deferred_revenue_enabled' => '1',
- ),
- );
- $this->callAPISuccess('Setting', 'create', $params);
- $settings = CRM_Contribute_PseudoConstant::checkContributeSettings('deferred_revenue_enabled');
- $this->assertEquals($settings, 1, "Check for settings has failed");
- }
-
-}