From 1f4bb60140305124b888dd0cfa57d7a98c53abe1 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 12 Jun 2013 20:54:27 -0700 Subject: [PATCH] Fix api constant test CRM-12464 ---------------------------------------- * CRM-12464: Add PseudoConstants to Schema Metadata http://issues.civicrm.org/jira/browse/CRM-12464 --- tests/phpunit/api/v3/ConstantTest.php | 36 +++++++++++---------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/tests/phpunit/api/v3/ConstantTest.php b/tests/phpunit/api/v3/ConstantTest.php index 0dc6689ea2..5e417823ee 100644 --- a/tests/phpunit/api/v3/ConstantTest.php +++ b/tests/phpunit/api/v3/ConstantTest.php @@ -33,9 +33,6 @@ * Include class definitions */ require_once 'CiviTest/CiviUnitTestCase.php'; -require_once 'api/v3/Constant.php'; -require_once 'CRM/Core/I18n.php'; -require_once 'CRM/Utils/Cache.php'; /** * Test APIv3 civicrm_activity_* functions @@ -117,19 +114,17 @@ class api_v3_ConstantTest extends CiviUnitTestCase { } /** - * Test civicrm_constant_get( 'locationType' ) + * Test civicrm_address_getoptions( 'location_type_id' ) */ public function testLocationTypeGet() { // needed to get rid of cached values from previous tests CRM_Core_PseudoConstant::flush(); - - $params = array( - 'name' => 'locationType', + 'field' => 'location_type_id', 'version' => $this->_apiversion, ); - $result = civicrm_api('constant', 'get', $params); + $result = civicrm_api('address', 'getoptions', $params); $this->assertAPISuccess($result); $this->documentMe($params, $result, __FUNCTION__, __FILE__); $this->assertTrue($result['count'] > 3, "In line " . __LINE__); @@ -143,14 +138,14 @@ class api_v3_ConstantTest extends CiviUnitTestCase { } /** - * Test civicrm_constant_get( 'phoneType' ) + * Test civicrm_phone_getoptions( 'phone_type_id' ) */ public function testPhoneType() { - $parameters = array(TRUE, FALSE, TRUE); - $result = civicrm_api('constant', 'get', array( - 'name' => 'phoneType', - 'version' => $this->_apiversion, - )); + $params = array( + 'field' => 'phone_type_id', + 'version' => $this->_apiversion, + ); + $result = civicrm_api('phone', 'getoptions', $params); $this->assertAPISuccess($result); $this->assertEquals(5, $result['count'], "In line " . __LINE__); @@ -169,14 +164,11 @@ class api_v3_ConstantTest extends CiviUnitTestCase { * Test civicrm_constant_get( 'mailProtocol' ) */ public function testmailProtocol() { - - - $parameters = array(TRUE, FALSE, TRUE); - - $result = civicrm_api('constant', 'get', array( - 'name' => 'mailProtocol', - 'version' => $this->_apiversion, - )); + $params = array( + 'field' => 'protocol', + 'version' => $this->_apiversion, + ); + $result = civicrm_api('mail_settings', 'getoptions', $params); $this->assertAPISuccess($result); $this->assertEquals(4, $result['count'], "In line " . __LINE__); -- 2.25.1