Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 | 2 | |
aba1cd8b EM |
3 | /** |
4 | * Class CRM_UF_Page_ProfileEditorTest | |
acb109b7 | 5 | * @group headless |
aba1cd8b | 6 | */ |
6a488035 | 7 | class CRM_UF_Page_ProfileEditorTest extends CiviUnitTestCase { |
39b959db | 8 | |
00be9182 | 9 | public function setUp() { |
6a488035 TO |
10 | parent::setUp(); |
11 | } | |
12 | ||
13 | /** | |
eceb18cc | 14 | * Spot check a few fields that should appear in schema. |
6a488035 | 15 | */ |
00be9182 | 16 | public function testGetSchema() { |
6a488035 TO |
17 | $schema = CRM_UF_Page_ProfileEditor::getSchema(array('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']); | |
23 | } | |
24 | } | |
25 | ||
26 | $this->assertEquals('Individual', $schema['IndividualModel']['schema']['first_name']['civiFieldType']); | |
2b42cc5e E |
27 | $this->assertTrue(empty($schema['IndividualModel']['schema']['first_name']['civiIsLocation'])); |
28 | $this->assertTrue(empty($schema['IndividualModel']['schema']['first_name']['civiIsPhone'])); | |
6a488035 TO |
29 | |
30 | $this->assertEquals('Contact', $schema['IndividualModel']['schema']['street_address']['civiFieldType']); | |
31 | $this->assertNotEmpty($schema['IndividualModel']['schema']['street_address']['civiIsLocation']); | |
2b42cc5e | 32 | $this->assertTrue(empty($schema['IndividualModel']['schema']['street_address']['civiIsPhone'])); |
6a488035 TO |
33 | |
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']); | |
37 | ||
38 | $this->assertEquals('Activity', $schema['ActivityModel']['schema']['activity_subject']['civiFieldType']); | |
2b42cc5e E |
39 | $this->assertTrue(empty($schema['ActivityModel']['schema']['activity_subject']['civiIsLocation'])); |
40 | $this->assertTrue(empty($schema['ActivityModel']['schema']['activity_subject']['civiIsPhone'])); | |
6a488035 TO |
41 | |
42 | // don't mix up contacts and activities | |
2b42cc5e E |
43 | $this->assertTrue(empty($schema['IndividualModel']['schema']['activity_subject'])); |
44 | $this->assertTrue(empty($schema['ActivityModel']['schema']['street_address'])); | |
6a488035 TO |
45 | |
46 | } | |
96025800 | 47 | |
6a488035 | 48 | } |