CRM-16101 - reminder tests: fix flapping status
[civicrm-core.git] / tests / phpunit / CRM / Core / DAOTest.php
index 2df3e2e287b1bf2c645a1233b53f2d691ae7dc08..fd4cce327c0610a3d446ac9578247942a33e541e 100644 (file)
@@ -6,18 +6,8 @@ require_once 'CiviTest/CiviUnitTestCase.php';
  * Class CRM_Core_DAOTest
  */
 class CRM_Core_DAOTest extends CiviUnitTestCase {
-  /**
-   * @return array
-   */
-  function get_info() {
-    return array(
-      'name'    => 'DAO',
-      'description' => 'Test core DAO functions',
-      'group'     => 'Core',
-    );
-  }
 
-  function testGetReferenceColumns() {
+  public function testGetReferenceColumns() {
     // choose CRM_Core_DAO_Email as an arbitrary example
     $emailRefs = CRM_Core_DAO_Email::getReferenceColumns();
     $refsByTarget = array();
@@ -31,7 +21,7 @@ class CRM_Core_DAOTest extends CiviUnitTestCase {
     $this->assertEquals('CRM_Core_Reference_Basic', get_class($contactRef));
   }
 
-  function testGetReferencesToTable() {
+  public function testGetReferencesToTable() {
     $refs = CRM_Core_DAO::getReferencesToTable(CRM_Financial_DAO_FinancialType::getTableName());
     $refsBySource = array();
     foreach ($refs as $refSpec) {
@@ -45,7 +35,7 @@ class CRM_Core_DAOTest extends CiviUnitTestCase {
     $this->assertEquals('CRM_Core_Reference_Dynamic', get_class($genericRef));
   }
 
-  function testFindReferences() {
+  public function testFindReferences() {
     $params = array(
       'first_name' => 'Testy',
       'last_name' => 'McScallion',
@@ -79,7 +69,7 @@ class CRM_Core_DAOTest extends CiviUnitTestCase {
   /**
    * @return array
    */
-  function composeQueryExamples() {
+  public function composeQueryExamples() {
     $cases = array();
     // $cases[] = array('Input-SQL', 'Input-Params', 'Expected-SQL');
 
@@ -143,8 +133,11 @@ class CRM_Core_DAOTest extends CiviUnitTestCase {
 
   /**
    * @dataProvider composeQueryExamples
+   * @param $inputSql
+   * @param $inputParams
+   * @param $expectSql
    */
-  function testComposeQuery($inputSql, $inputParams, $expectSql) {
+  public function testComposeQuery($inputSql, $inputParams, $expectSql) {
     $actualSql = CRM_Core_DAO::composeQuery($inputSql, $inputParams);
     $this->assertEquals($expectSql, $actualSql);
   }
@@ -156,7 +149,7 @@ class CRM_Core_DAOTest extends CiviUnitTestCase {
   // 'SELECT * FROM whatever WHERE name = %1 AND title = %3 AND year LIKE '%2012'
   // $params[3] = array('Bob', 'String');
   // i.e. the place holder should be unique and should not contain in any other operational use in query
-  function testComposeQueryFailure() {
+  public function testComposeQueryFailure() {
     $cases[] = array(
       'SELECT * FROM whatever WHERE name = %1 AND title = %2 AND year LIKE \'%2012\' ',
       array(
@@ -173,26 +166,48 @@ class CRM_Core_DAOTest extends CiviUnitTestCase {
   /**
    * @return array
    */
-  function sqlNameDataProvider() {
+  public function sqlNameDataProvider() {
     return array(
       array('this is a long string', 30, FALSE, 'this is a long string'),
-
-      array('this is an even longer string which is exactly 60 character', 60, FALSE, 'this is an even longer string which is exactly 60 character'),
-      array('this is an even longer string which is exactly 60 character', 60, TRUE , 'this is an even longer string which is exactly 60 character'),
-
-      array('this is an even longer string which is a bit more than 60 character', 60, FALSE, 'this is an even longer string which is a bit more than 60 ch'),
-      array('this is an even longer string which is a bit more than 60 character', 60, TRUE , 'this is an even longer string which is a bit more th_c1cbd519'),
+      array(
+        'this is an even longer string which is exactly 60 character',
+        60,
+        FALSE,
+        'this is an even longer string which is exactly 60 character'
+      ),
+      array(
+        'this is an even longer string which is exactly 60 character',
+        60,
+        TRUE,
+        'this is an even longer string which is exactly 60 character'
+      ),
+      array(
+        'this is an even longer string which is a bit more than 60 character',
+        60,
+        FALSE,
+        'this is an even longer string which is a bit more than 60 ch'
+      ),
+      array(
+        'this is an even longer string which is a bit more than 60 character',
+        60,
+        TRUE,
+        'this is an even longer string which is a bit more th_c1cbd519'
+      ),
     );
   }
 
   /**
    * @dataProvider sqlNameDataProvider
+   * @param $inputData
+   * @param $length
+   * @param $makeRandom
+   * @param $expectedResult
    */
-  function testShortenSQLName($inputData, $length, $makeRandom, $expectedResult) {
+  public function testShortenSQLName($inputData, $length, $makeRandom, $expectedResult) {
     $this->assertEquals($expectedResult, CRM_Core_DAO::shortenSQLName($inputData, $length, $makeRandom));
   }
 
-  function testFindById() {
+  public function testFindById() {
     $params = $this->sampleContact('Individual', 4);
     $existing_contact = CRM_Contact_BAO_Contact::add($params);
     $contact = CRM_Contact_BAO_Contact::findById($existing_contact->id);