Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.2.0
-
Fix Version/s: 2.2.0
-
Component/s: CiviCRM API, Core CiviCRM
-
Labels:None
Description
Unit tests in r19529 from the repository were executed. The first symptom observed is that when the Contact Add With Custom Data test (only) is run it completes successfully, but when the entire API test suite is run, this test fails at lines 270 and 271.
The first bug is in tests/api/v2/ContactAddWithCustomData.test line 114 which declares
function atestCreateIndividualwithSingleValueCustomData( )
This should be
function testCreateIndividualwithSingleValueCustomData( )
Simpletest never executed this test because it only executes test methods with names beginning 'test'.
With that bug fixed, the test now fails at those lines even if it is the only test run. The underlying problem is in CRM_Core_BAO_CustomFields::getFields() lines 314-329 which compute the value of $cacheKey. The key value is computed only from the query, not the contents of the database. So the basic problem is that the first time the query runs the results are cached with this key. Then if the contents of the table change and the same query is run again, the old stale cached results are returned instead of the new correct value.