Answers.Body: <p>For most of the tests, it was sufficient to <a href="https://github.com/johanv/civicrm-core/commit/4f0a0e58134ce12ed22ce0261145ced0252d1323" rel="nofollow">provide an <code>assignTestValue</code> method</a> in the SavedSearch BAO.</p>
  
  <p>This did not solve the problem though for <a href="https://test.civicrm.org/job/CiviCRM-Core-PR/3923/testReport/junit/%28root%29/api_v3_SyntaxConformanceTest__testCreateSingleValueAlter/testCreateSingleValueAlter_with_data_set__46/" rel="nofollow">testCreateSingleValueAlter</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-22T10:41:42.473Z
Answers.LastActivityDate: 2015-06-22T10:41:42.473Z
Answers.UserDisplayName: johanv
Body: <p>I created a <a href="https://github.com/civicrm/civicrm-core/pull/6059" rel="nofollow">patch for CiviCRM</a> that allows saved searches to be created using the API.</p>
  
  <p>Now it turns out that this SavedSearch API <a href="https://test.civicrm.org/job/CiviCRM-Core-PR/3907/" rel="nofollow">does not pass</a> certain syntax conformance unit tests.</p>
  
  <p>One of the problem is that some of the tests try to create a new saved search, and they try to assign a string like <code>form_values_273form_values_576</code> to the <code>form_values</code> field of the saved search entity.</p>
  
  <p>The saved search BAO expect <code>form_values</code> to be a serialized array, and because <code>form_values_273form_values_576</code> obviously is not, errors occur, causing some the unit tests to fail. (see e.g. line 239 of /CRM/Contact/BAO/SavedSearch.php)</p>
  
  <p>Is there a way to make those unit tests use a sensible value for <code>form_value</code>? <code>NULL</code> should do as well, I guess.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-22T06:43:58.287Z
Comments.Text: I think this forum thread is related: http://forum.civicrm.org/index.php?topic=33990.0
Comments.UserDisplayName: johanv
Tags: <api>
Title: How to make the SyntaxConformanceTest use sensible values when it calls the create action of my new API?
ThreadText: # How to make the SyntaxConformanceTest use sensible values when it calls the create action of my new API?
  
  (Asked by: username_0 on 2015-06-22)
  
  I created a [patch for CiviCRM](https://github.com/civicrm/civicrm-core/pull/6059) that allows saved searches to be created using the API.
  
  Now it turns out that this SavedSearch API [does not pass](https://test.civicrm.org/job/CiviCRM-Core-PR/3907/) certain syntax conformance unit tests.
  
  One of the problem is that some of the tests try to create a new saved search, and they try to assign a string like `form_values_273form_values_576` to the `form_values` field of the saved search entity.
  
  The saved search BAO expect `form_values` to be a serialized array, and because `form_values_273form_values_576` obviously is not, errors occur, causing some the unit tests to fail. (see e.g. line 239 of /CRM/Contact/BAO/SavedSearch.php)
  
  Is there a way to make those unit tests use a sensible value for `form_value`? `NULL` should do as well, I guess.
  
  **Tags:** api
  
  > **Comments:**
  > **username_0**: I think this forum thread is related: http://forum.civicrm.org/index.php?topic=33990.0  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-06-22. Score: 1
  
  For most of the tests, it was sufficient to [provide an `assignTestValue` method](https://github.com/username_0/civicrm-core/commit/4f0a0e58134ce12ed22ce0261145ced0252d1323) in the SavedSearch BAO.
  
  This did not solve the problem though for [testCreateSingleValueAlter](https://test.civicrm.org/job/CiviCRM-Core-PR/3923/testReport/junit/%28root%29/api_v3_SyntaxConformanceTest__testCreateSingleValueAlter/testCreateSingleValueAlter_with_data_set__46/).
  
  
  ---
  
  