From 2bd410d6b048d00799c14414076b27024aeb6121 Mon Sep 17 00:00:00 2001 From: Jon goldberg Date: Mon, 27 Apr 2015 16:57:07 -0600 Subject: [PATCH] CRM-13283 - add API unit tests to StatusPreference to support passing a string as a minimum_report_severity --- tests/phpunit/api/v3/StatusPreferenceTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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); + } + } -- 2.25.1