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