Commit | Line | Data |
---|---|---|
fa6ace1a | 1 | <?php |
2 | ||
fa6ace1a | 3 | /** |
4 | * Class for testing new DAO meet required standards. | |
5 | * | |
6 | * Class CRM_Core_DAOTest | |
acb109b7 | 7 | * @group headless |
fa6ace1a | 8 | */ |
9 | class CRM_Core_DAOConformanceTest extends CiviUnitTestCase { | |
10 | ||
11 | /** | |
12 | * Check all fields have defined titles. | |
13 | * | |
14 | * @dataProvider getAllDAO | |
15 | */ | |
16 | public function testFieldsHaveTitles($class) { | |
17 | $dao = new $class(); | |
18 | $fields = $dao->fields(); | |
19 | foreach ($fields as $name => $field) { | |
20 | $this->assertArrayHasKey('title', $field, "A title must be defined for $name in $class"); | |
21 | } | |
22 | } | |
23 | ||
24 | /** | |
25 | * Get all DAO classes. | |
26 | */ | |
27 | public function getAllDAO() { | |
39b959db SL |
28 | // Ugh. Need full bootstrap to enumerate classes. |
29 | $this->setUp(); | |
fa6ace1a | 30 | $classList = CRM_Core_DAO_AllCoreTables::getClasses(); |
9099cab3 | 31 | $return = []; |
fa6ace1a | 32 | foreach ($classList as $class) { |
9099cab3 | 33 | $return[] = [$class]; |
fa6ace1a | 34 | } |
35 | return $return; | |
36 | } | |
37 | ||
fa6ace1a | 38 | } |