tests/phpunit/** - Remove unnecessary "require_once" statements
[civicrm-core.git] / tests / phpunit / CRM / Core / DAOTest.php
index 6d4f6efca5d51e53324f6790051f2290e517fdb4..9fae687224bf05397c0a614507b5812f36f216c7 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-require_once 'CiviTest/CiviUnitTestCase.php';
-
 /**
  * Class CRM_Core_DAOTest
  */
@@ -133,19 +131,24 @@ class CRM_Core_DAOTest extends CiviUnitTestCase {
 
   /**
    * @dataProvider composeQueryExamples
+   * @param $inputSql
+   * @param $inputParams
+   * @param $expectSql
    */
   public function testComposeQuery($inputSql, $inputParams, $expectSql) {
     $actualSql = CRM_Core_DAO::composeQuery($inputSql, $inputParams);
     $this->assertEquals($expectSql, $actualSql);
   }
 
-  // CASE: Two params where the %2 is already present in the query
-  // NOTE: This case should rightly FAIL, as using strstr in the replace mechanism will turn
-  // the query into: SELECT * FROM whatever WHERE name = 'Alice' AND title = 'Bob' AND year LIKE ''Bob'012'
-  // So, to avoid such ERROR, the query should be framed like:
-  // '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
+  /**
+   * CASE: Two params where the %2 is already present in the query
+   * NOTE: This case should rightly FAIL, as using strstr in the replace mechanism will turn
+   * the query into: SELECT * FROM whatever WHERE name = 'Alice' AND title = 'Bob' AND year LIKE ''Bob'012'
+   * So, to avoid such ERROR, the query should be framed like:
+   * '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
+   */
   public function testComposeQueryFailure() {
     $cases[] = array(
       'SELECT * FROM whatever WHERE name = %1 AND title = %2 AND year LIKE \'%2012\' ',
@@ -166,17 +169,39 @@ class CRM_Core_DAOTest extends CiviUnitTestCase {
   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
    */
   public function testShortenSQLName($inputData, $length, $makeRandom, $expectedResult) {
     $this->assertEquals($expectedResult, CRM_Core_DAO::shortenSQLName($inputData, $length, $makeRandom));
@@ -198,4 +223,5 @@ class CRM_Core_DAOTest extends CiviUnitTestCase {
     }
     $this->assertTrue($exception_thrown);
   }
+
 }