CRM-14355 test to check existing behaviour of alternate syntaxes
authorEileen McNaughton <eileen@fuzion.co.nz>
Tue, 18 Mar 2014 21:50:12 +0000 (10:50 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Wed, 19 Mar 2014 00:45:03 +0000 (13:45 +1300)
----------------------------------------
* CRM-14355: make api treat limit = 0 as an unlimited request
  http://issues.civicrm.org/jira/browse/CRM-14355

tests/phpunit/api/v3/SyntaxConformanceTest.php

index 8de7961999f0380d117ff0ce0fcdfaa056e18745..7ccd35ae6062c697f381be3679a37a479c2c16de 100644 (file)
@@ -560,6 +560,23 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
       $result = $this->callAPISuccess($entityName, 'get', $case[0]);
       $this->assertEquals($case[1], $result['count'], $case[2]);
       $this->assertEquals($case[1], count($result['values']));
+
+      //non preferred / legacy syntax
+      if(isset($case[0]['options']['limit'])) {
+        $result = $this->callAPISuccess($entityName, 'get', array('rowCount' => $case[0]['options']['limit']));
+        $this->assertEquals($case[1], $result['count'], $case[2]);
+        $this->assertEquals($case[1], count($result['values']));
+
+        //non preferred / legacy syntax
+        $result = $this->callAPISuccess($entityName, 'get', array('option_limit' => $case[0]['options']['limit']));
+        $this->assertEquals($case[1], $result['count'], $case[2]);
+        $this->assertEquals($case[1], count($result['values']));
+
+        //non preferred / legacy syntax
+        $result = $this->callAPISuccess($entityName, 'get', array('option.limit' => $case[0]['options']['limit']));
+        $this->assertEquals($case[1], $result['count'], $case[2]);
+        $this->assertEquals($case[1], count($result['values']));
+      }
     }
   }