CRM-13234 api/v3/Profile fix tests & support lower case primary fields

Also a minor fix on api.php, some metadata changes on ufField api, an eNotice & function signature fix on 
CRM/Core/BAO/UFField.php  and a fix to flush caches when creating custom fields in the api. 
All other fixes are to comment blocks, tests & test-generated examples. 

Almost all actual changes are in the profile.api file