return static::entities(static::toBeSkipped_delete(TRUE));
}
+ /**
+ * @return array
+ */
+ public static function entities_getfields() {
+ return static::entities(static::toBeSkipped_getfields(TRUE));
+ }
/**
* @return array
*/
return $entities;
}
+ /**
+ * @param bool $sequential
+ *
+ * @return array
+ * @todo add metadata for ALL these entities
+ */
+ public static function toBeSkipped_getfields($sequential = FALSE) {
+ $entitiesWithMetadataNotYetFixed = array('ReportTemplate', 'CustomSearch');
+ if ($sequential === TRUE) {
+ return $entitiesWithMetadataNotYetFixed ;
+ }
+ $entities = array();
+ foreach ($entitiesWithMetadataNotYetFixed as $e) {
+ $entities[] = array($e);
+ }
+ return $entities;
+ }
/**
* Generate list of entities to test for get by id functions
* @param boolean $sequential
);
}
+ /**
+ * Create two entities and make sure delete action only deletes one!
+ *
+ * @dataProvider entities_getfields
+ *
+ */
+ public function testGetfieldsHasTitle($entity) {
+ $entities = $this->getEntitiesSupportingCustomFields();
+ if (in_array($entity, $entities)) {
+ $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, $entity . 'Test.php');
+ }
+ $actions = $this->callAPISuccess($entity, 'getactions', array());
+ foreach ($actions['values'] as $action) {
+ if (substr($action, -7) == '_create' || substr($action, -4) == '_get' || substr($action, -7) == '_delete') {
+ //getactions can't distinguish between contribution_page.create & contribution_page.create
+ continue;
+ }
+ $fields = $this->callAPISuccess($entity, 'getfields', array('action' => $action));
+ if (!empty($ids) && in_array($action, array('create', 'get'))) {
+ $this->assertArrayHasKey('custom_' . $ids['custom_field_id'], $fields['values']);
+ }
+
+ foreach ($fields['values'] as $fieldName => $fieldSpec) {
+ $this->assertArrayHasKey('title', $fieldSpec, "no title for $entity - $fieldName on action $action");
+ $this->assertNotEmpty($fieldSpec['title'], "empty title for $entity - $fieldName");
+ }
+ }
+ if (!empty($ids)) {
+ $this->customFieldDelete($ids['custom_field_id']);
+ $this->customGroupDelete($ids['custom_group_id']);
+ }
+ }
+
+ /**
+ * @return array
+ */
+ public function getEntitiesSupportingCustomFields() {
+ $entities = self::custom_data_entities_get();
+ $returnEntities = array();
+ foreach ($entities as $entityArray) {
+ $returnEntities[] = $entityArray[0];
+ }
+ return $returnEntities;
+ }
/**
* @param $entityName
* @param int $count
1 => array($eventId, 'Integer')
));
}
-
}