INFRA-132 - FunctionDeclarationArgumentSpacing.SpaceBeforeEquals
[civicrm-core.git] / tests / phpunit / CRM / Contact / BAO / QueryTest.php
index 853368ed78ae4a93f3807950be8857f207f1e650..e4fb4130fe3222d582a18c370de8a518374f8232 100644 (file)
@@ -14,11 +14,11 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
     return new CRM_Contact_BAO_QueryTestDataProvider;
   }
 
-  function setUp() {
+  public function setUp() {
     parent::setUp();
   }
 
-  function tearDown() {
+  public function tearDown() {
     $tablesToTruncate = array(
       'civicrm_group_contact',
       'civicrm_group',
@@ -32,9 +32,9 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
 
   /**
    *  Test CRM_Contact_BAO_Query::searchQuery()
-   *  @dataProvider dataProvider
+   * @dataProvider dataProvider
    */
-  function testSearch($fv, $count, $ids, $full) {
+  public function testSearch($fv, $count, $ids, $full) {
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn,
       $this->createFlatXMLDataSet(
@@ -65,10 +65,10 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
    * Check that we get a successful result querying for home address
    * CRM-14263 search builder failure with search profile & address in criteria
    */
-  function testSearchProfileHomeCityCRM14263() {
+  public function testSearchProfileHomeCityCRM14263() {
     $contactID = $this->individualCreate();
     CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
-    $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
+    $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1));
     $params = array(
       0 => array(
         0 => 'city-1',
@@ -76,7 +76,7 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
         2 => 'Cool City',
         3 => 1,
         4 => 0,
-      )
+      ),
     );
     $returnProperties = array(
       'contact_type' => 1,
@@ -103,10 +103,10 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
    * Check that we get a successful result querying for home address
    * CRM-14263 search builder failure with search profile & address in criteria
    */
-  function testSearchProfileHomeCityNoResultsCRM14263() {
+  public function testSearchProfileHomeCityNoResultsCRM14263() {
     $contactID = $this->individualCreate();
     CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
-    $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
+    $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1));
     $params = array(
       0 => array(
         0 => 'city-1',
@@ -114,7 +114,7 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
         2 => 'Dumb City',
         3 => 1,
         4 => 0,
-      )
+      ),
     );
     $returnProperties = array(
       'contact_type' => 1,
@@ -136,43 +136,41 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
 
     }
   }
-    /**
-     * CRM-14263 search builder failure with search profile & address in criteria
-     * We are retrieving primary here - checking the actual sql seems super prescriptive - but since the massive query object has
-     * so few tests detecting any change seems good here :-)
-     */
-    function testSearchProfilePrimaryCityCRM14263()
-    {
-      $contactID = $this->individualCreate();
-      CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
-      $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
-      $params = array(
+  /**
+   * CRM-14263 search builder failure with search profile & address in criteria
+   * We are retrieving primary here - checking the actual sql seems super prescriptive - but since the massive query object has
+   * so few tests detecting any change seems good here :-)
+   */
+  public function testSearchProfilePrimaryCityCRM14263() {
+    $contactID = $this->individualCreate();
+    CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
+    $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1));
+    $params = array(
         0 => array(
           0 => 'city',
           1 => '=',
           2 => 'Cool City',
           3 => 1,
           4 => 0,
-        )
+        ),
       );
-      $returnProperties = array(
+    $returnProperties = array(
         'contact_type' => 1,
         'contact_sub_type' => 1,
         'sort_name' => 1,
       );
-      $expectedSQL = "SELECT contact_a.id as contact_id, contact_a.contact_type  as `contact_type`, contact_a.contact_sub_type  as `contact_sub_type`, contact_a.sort_name  as `sort_name`, civicrm_address.id as address_id, civicrm_address.city as `city`  FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) WHERE  (  ( LOWER(civicrm_address.city) = 'cool city' )  )  AND (contact_a.is_deleted = 0)    ORDER BY contact_a.sort_name asc, contact_a.id ";
-      $queryObj = new CRM_Contact_BAO_Query($params, $returnProperties);
-      try {
-        $this->assertEquals($expectedSQL ,$queryObj->searchQuery(0, 0, NULL,
+    $expectedSQL = "SELECT contact_a.id as contact_id, contact_a.contact_type  as `contact_type`, contact_a.contact_sub_type  as `contact_sub_type`, contact_a.sort_name  as `sort_name`, civicrm_address.id as address_id, civicrm_address.city as `city`  FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) WHERE  (  ( LOWER(civicrm_address.city) = 'cool city' )  )  AND (contact_a.is_deleted = 0)    ORDER BY contact_a.sort_name asc, contact_a.id ";
+    $queryObj = new CRM_Contact_BAO_Query($params, $returnProperties);
+    try {
+      $this->assertEquals($expectedSQL, $queryObj->searchQuery(0, 0, NULL,
           FALSE, FALSE,
           FALSE, FALSE,
           TRUE));
-      }
-      catch (PEAR_Exception $e) {
-        $err = $e->getCause();
-        $this->fail('invalid SQL created' . $e->getMessage() . " " . $err->userinfo);
+    }
+    catch (PEAR_Exception $e) {
+      $err = $e->getCause();
+      $this->fail('invalid SQL created' . $e->getMessage() . " " . $err->userinfo);
 
-      }
     }
+  }
 }
-