From: Jon goldberg Date: Mon, 27 Apr 2015 22:57:07 +0000 (-0600) Subject: CRM-13283 - add API unit tests to StatusPreference to support passing a string as... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2bd410d6b048d00799c14414076b27024aeb6121;p=civicrm-core.git CRM-13283 - add API unit tests to StatusPreference to support passing a string as a minimum_report_severity --- diff --git a/tests/phpunit/api/v3/StatusPreferenceTest.php b/tests/phpunit/api/v3/StatusPreferenceTest.php index 3091e967fb..804cff324a 100644 --- a/tests/phpunit/api/v3/StatusPreferenceTest.php +++ b/tests/phpunit/api/v3/StatusPreferenceTest.php @@ -108,4 +108,23 @@ class api_v3_StatusPreferenceTest extends CiviUnitTestCase { $result = $this->callAPIFailure('StatusPreference', 'create', $this->_params); } + /** + * Test creating a severity by name, not integer. + */ + public function testCreateSeverityByName() { + // Any permutation of uppercase/lowercase should work. + $this->_params['minimum_report_severity'] = 'cRItical'; + $result = $this->callAPIAndDocument('StatusPreference', 'create', $this->_params, __FUNCTION__, __FILE__); + $id = $result['id']; + $this->assertEquals(5, $result['values'][$id]['minimum_report_severity'], 'In line ' . __LINE__); + } + + /** + * Test creating an invalid severity by name. + */ + public function testCreateSeverityWithInvalidName() { + $this->_params['minimum_report_severity'] = 'wdsadasdarning'; + $result = $this->callAPIFailure('StatusPreference', 'create', $this->_params); + } + }