From c32ede298eb668dec28b04f50c1df103fb475a56 Mon Sep 17 00:00:00 2001 From: Johan Vervloet Date: Fri, 23 Oct 2015 21:19:42 +0200 Subject: [PATCH] CRM-17430 - Unit test: changing domain name shouldn't change CiviCRM version. ---------------------------------------- * CRM-17430: Altering the domain using the API changes the CiviCRM version to 3 https://issues.civicrm.org/jira/browse/CRM-17430 --- tests/phpunit/api/v3/DomainTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/phpunit/api/v3/DomainTest.php b/tests/phpunit/api/v3/DomainTest.php index 3964dc4f51..e47843b7b5 100644 --- a/tests/phpunit/api/v3/DomainTest.php +++ b/tests/phpunit/api/v3/DomainTest.php @@ -175,6 +175,29 @@ class api_v3_DomainTest extends CiviUnitTestCase { $this->assertEquals($result['values'][$result['id']]['version'], $this->params['domain_version']); } + /** + * Test if Domain.create does not touch the version of the domain. + * + * See CRM-17430. + */ + public function testUpdateDomainName() { + // First create a domain. + $domain_result = $this->callAPISuccess('domain', 'create', $this->params); + $domain_before = $this->callAPISuccess('Domain', 'getsingle', array('id' => $domain_result['id'])); + + // Change domain name. + $this->callAPISuccess('Domain', 'create', array( + 'id' => $domain_result['id'], + 'name' => 'B-Team domain', + )); + + // Get domain again. + $domain_after = $this->callAPISuccess('Domain', 'getsingle', array('id' => $domain_result['id'])); + + // Version should still be the same. + $this->assertEquals($domain_before['version'], $domain_after['version']); + } + /** * Test civicrm_domain_create with empty params. * -- 2.25.1