From: Seamus Lee Date: Mon, 31 Jul 2017 06:36:48 +0000 (+1000) Subject: Add Unit test to provde domain filtering is working with activeProviderCount X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=eb6078c832ce90c7e6bd9b28bc32dfc6c28d155f;p=civicrm-core.git Add Unit test to provde domain filtering is working with activeProviderCount --- diff --git a/tests/phpunit/CRM/SMS/BAO/ProviderTest.php b/tests/phpunit/CRM/SMS/BAO/ProviderTest.php index 185edf826b..89ad4c9ae1 100644 --- a/tests/phpunit/CRM/SMS/BAO/ProviderTest.php +++ b/tests/phpunit/CRM/SMS/BAO/ProviderTest.php @@ -77,6 +77,32 @@ class CRM_SMS_BAO_ProviderTest extends CiviUnitTestCase { CRM_SMS_BAO_Provider::del($provider['id']); } + /** + * CRM-20989 + * Add unit test to ensure that filtering by domain works in get Active Providers + */ + public function testActiveProviderCount() { + $values = array( + 'domain_id' => NULL, + 'title' => 'test SMS provider', + 'username' => 'test', + 'password' => 'dummpy password', + 'name' => 1, + 'is_active' => 1, + 'api_type' => 1, + ); + $provider = $this->callAPISuccess('SmsProvider', 'create', $values); + $provider2 = $this->callAPISuccess('SmsProvider', 'create', array_merge($values, array('domain_id' => 2))); + $result = CRM_SMS_BAO_Provider::activeProviderCount(); + $this->assertEquals(1, $result); + $provider3 = $this->callAPISuccess('SmsProvider', 'create', array_merge($values, array('domain_id' => 1))); + $result = CRM_SMS_BAO_Provider::activeProviderCount(); + $this->assertEquals(2, $result); + CRM_SMS_BAO_Provider::del($provider['id']); + CRM_SMS_BAO_Provider::del($provider2['id']); + CRM_SMS_BAO_Provider::del($provider3['id']); + } + /** * CRM-19961 Check that when a domain is not passed when saving it defaults to current domain when create */