From 8ab09481186501c2d9eae0be38f0aba2847a918b Mon Sep 17 00:00:00 2001 From: monishdeb Date: Mon, 28 Sep 2015 04:00:14 +0530 Subject: [PATCH] master Test fixes --- CRM/Contact/BAO/Query.php | 2 +- CRM/Contact/BAO/SavedSearch.php | 4 ++-- .../CRM/Contact/BAO/QueryTestDataProvider.php | 12 ++++++------ tests/phpunit/api/v3/SyntaxConformanceTest.php | 16 ++++++++++++---- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 54873b5b87..e9dec74b59 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -2001,7 +2001,7 @@ class CRM_Contact_BAO_Query { $where = "civicrm_address.state_province_id"; } - $this->_where[$grouping][] = self::buildClause($where, $op, $value, 'Positive'); + $this->_where[$grouping][] = self::buildClause($where, $op, $value); list($qillop, $qillVal) = self::buildQillForFieldValue('CRM_Core_DAO_Address', "state_province_id", $value, $op); $this->_qill[$grouping][] = ts("State %1 %2", array(1 => $qillop, 2 => $qillVal)); } diff --git a/CRM/Contact/BAO/SavedSearch.php b/CRM/Contact/BAO/SavedSearch.php index b89446ee24..d3b0307a35 100644 --- a/CRM/Contact/BAO/SavedSearch.php +++ b/CRM/Contact/BAO/SavedSearch.php @@ -252,11 +252,11 @@ LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_ } } - public function save() { + public function save($hook = TRUE) { // first build the computed fields $this->buildClause(); - parent::save(); + parent::save($hook); } /** diff --git a/tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php b/tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php index 4f7f415c9c..ca44aaa6c9 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php @@ -51,7 +51,7 @@ class CRM_Contact_BAO_QueryTestDataProvider implements Iterator { private $dataset = array( // Include static group 3 array( - 'fv' => array('group' => array('3' => 1)), + 'fv' => array('group' => '3'), 'id' => array( '17', '18', @@ -65,7 +65,7 @@ class CRM_Contact_BAO_QueryTestDataProvider implements Iterator { ), // Include static group 5 array( - 'fv' => array('group' => array('5' => 1)), + 'fv' => array('group' => '5'), 'id' => array( '13', '14', @@ -79,7 +79,7 @@ class CRM_Contact_BAO_QueryTestDataProvider implements Iterator { ), // Include static groups 3 and 5 array( - 'fv' => array('group' => array('3' => 1, '5' => 1)), + 'fv' => array('group' => array('3', '5')), 'id' => array( '13', '14', @@ -97,7 +97,7 @@ class CRM_Contact_BAO_QueryTestDataProvider implements Iterator { ), // Include tag 7 array( - 'fv' => array('tag' => array('7' => 1)), + 'fv' => array('tag' => '7'), 'id' => array( '11', '12', @@ -111,7 +111,7 @@ class CRM_Contact_BAO_QueryTestDataProvider implements Iterator { ), // Include tag 9 array( - 'fv' => array('tag' => array('9' => 1)), + 'fv' => array('tag' => '9'), 'id' => array( '10', '12', @@ -125,7 +125,7 @@ class CRM_Contact_BAO_QueryTestDataProvider implements Iterator { ), // Include tags 7 and 9 array( - 'fv' => array('tag' => array('7' => 1, '9' => 1)), + 'fv' => array('tag' => array('7', '9')), 'id' => array( '10', '11', diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 1d9a1fe5fd..a0540c78ea 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -292,13 +292,15 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { * User doesn't support get By ID because the user id is actually the CMS user ID & is not part of * CiviCRM - so can only be tested through UserTest - not SyntaxConformanceTest. * + * Entity doesn't support get By ID because it simply gives the result of string Entites in CiviCRM + * * @param bool $sequential * * @return array * Entities that cannot be retrieved by ID */ public static function toBeSkipped_getByID($sequential = FALSE) { - return array('MailingContact', 'User'); + return array('MailingContact', 'User', 'Attachment', 'Entity'); } /** @@ -891,11 +893,17 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { * @param string $entityName */ public function testSqlOperators($entityName) { - $baoString = _civicrm_api3_get_BAO($entityName); - if (empty($baoString)) { - $this->markTestIncomplete("Entity [$entityName] cannot be mocked - no known DAO"); + $toBeIgnored = array_merge($this->toBeImplemented['get'], + $this->deprecatedAPI, + $this->toBeSkipped_get(TRUE), + $this->toBeSkipped_getByID() + ); + if (in_array($entityName, $toBeIgnored)) { return; } + + $baoString = _civicrm_api3_get_BAO($entityName); + $entities = $this->callAPISuccess($entityName, 'get', array('options' => array('limit' => 0), 'return' => 'id')); $entities = array_keys($entities['values']); $totalEntities = count($entities); -- 2.25.1