4 * Class CRM_Contact_BAO_QueryStateNameTest
7 class CRM_Contact_BAO_QueryStateNameTest
extends CiviUnitTestCase
{
10 * Test case for state_province_name pseudofield
12 * See CRM-15505: Mailing labels show the state/province name as the abbreviation rather than the full state/province name
13 * Change to CRM_Contact_BAO_query::convertToPseudoNames()
15 public function testStateName() {
16 $state_name = 'Norfolk';
17 $state_abbreviation = 'NFK';
19 'contact_type' => 'Individual',
20 'first_name' => 'John',
22 'api.Address.create' => [
23 'location_type_id' => 'Home',
24 'state_province_id' => $state_name,
27 $create_res = civicrm_api3('Contact', 'Create', $create_params);
30 'id' => $create_res['id'],
33 $get_res = civicrm_api3('Contact', 'get', $get_params);
34 $this->assertEquals($state_name, $get_res['values'][0]['state_province_name']);
35 // Lock in that state_provice should equal that of the abbreviation.
36 $this->assertEquals($state_abbreviation, $get_res['values'][0]['state_province']);