4 * Class CRM_UF_Page_ProfileEditorTest
7 class CRM_UF_Page_ProfileEditorTest
extends CiviUnitTestCase
{
9 public function setUp() {
14 * Spot check a few fields that should appear in schema.
16 public function testGetSchema() {
17 $schema = CRM_UF_Page_ProfileEditor
::getSchema(['IndividualModel', 'ActivityModel']);
18 foreach ($schema as $entityName => $entityDef) {
19 foreach ($entityDef['schema'] as $fieldName => $fieldDef) {
20 $this->assertNotEmpty($fieldDef['type']);
21 $this->assertNotEmpty($fieldDef['title']);
22 $this->assertNotEmpty($fieldDef['civiFieldType']);
26 $this->assertEquals('Individual', $schema['IndividualModel']['schema']['first_name']['civiFieldType']);
27 $this->assertTrue(empty($schema['IndividualModel']['schema']['first_name']['civiIsLocation']));
28 $this->assertTrue(empty($schema['IndividualModel']['schema']['first_name']['civiIsPhone']));
30 $this->assertEquals('Contact', $schema['IndividualModel']['schema']['street_address']['civiFieldType']);
31 $this->assertNotEmpty($schema['IndividualModel']['schema']['street_address']['civiIsLocation']);
32 $this->assertTrue(empty($schema['IndividualModel']['schema']['street_address']['civiIsPhone']));
34 $this->assertEquals('Contact', $schema['IndividualModel']['schema']['phone_and_ext']['civiFieldType']);
35 $this->assertNotEmpty($schema['IndividualModel']['schema']['phone_and_ext']['civiIsLocation']);
36 $this->assertNotEmpty($schema['IndividualModel']['schema']['phone_and_ext']['civiIsPhone']);
38 $this->assertEquals('Activity', $schema['ActivityModel']['schema']['activity_subject']['civiFieldType']);
39 $this->assertTrue(empty($schema['ActivityModel']['schema']['activity_subject']['civiIsLocation']));
40 $this->assertTrue(empty($schema['ActivityModel']['schema']['activity_subject']['civiIsPhone']));
42 // don't mix up contacts and activities
43 $this->assertTrue(empty($schema['IndividualModel']['schema']['activity_subject']));
44 $this->assertTrue(empty($schema['ActivityModel']['schema']['street_address']));