From 3a15378cce1c19a7f6c28958a8ff69f7ef635999 Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 5 Jun 2016 16:27:51 -0600 Subject: [PATCH] CRM-10210 add test for international strings --- tests/phpunit/api/v3/ContactTest.php | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index 8ea30e2eb1..910be009c9 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -115,6 +115,46 @@ class api_v3_ContactTest extends CiviUnitTestCase { ); } + /** + * Test for international string acceptance (CRM-10210). + * + * @dataProvider getInternationalStrings + * + * @param string $string + * String to be tested. + * + * @throws \Exception + */ + public function testInternationalStrings($string) { + $this->callAPISuccess('Contact', 'create', array_merge( + $this->_params, + array('first_name' => $string) + )); + $result = $this->callAPISuccessGetSingle('Contact', array('first_name' => $string)); + $this->assertEquals($string, $result['first_name']); + + $organizationParams = array( + 'organization_name' => $string, + 'contact_type' => 'Organization', + ); + + $this->callAPISuccess('Contact', 'create', $organizationParams); + $result = $this->callAPISuccessGetSingle('Contact', $organizationParams); + $this->assertEquals($string, $result['organization_name']); + } + + /** + * Get international string data for testing against api calls. + */ + public function getInternationalStrings() { + $invocations = array(); + $invocations[] = array('Scarabée'); + $invocations[] = array('Iñtërnâtiônàlizætiøn'); + $invocations[] = array('これは日本語のテキストです。読めますか'); + $invocations[] = array('देखें हिन्दी कैसी नजर आती है। अरे वाह ये तो नजर आती है।'); + return $invocations; + } + /** * Test civicrm_contact_create. * -- 2.25.1