Merge branch 'MDL-63337-master' of git://github.com/bmbrands/moodle
[moodle.git] / course / tests / externallib_test.php
index abde22d..e7759b0 100644 (file)
@@ -2556,6 +2556,66 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
                 'expectedcourses' => ['cfuture', 'dfuture', 'efuture'],
                 'expectednextoffset' => 15
             ],
+            'all no limit or offset' => [
+                'coursedata' => $coursedata,
+                'classification' => 'all',
+                'limit' => 0,
+                'offset' => 0,
+                'expectedcourses' => [
+                    'afuture',
+                    'ainprogress',
+                    'apast',
+                    'bfuture',
+                    'binprogress',
+                    'bpast',
+                    'cfuture',
+                    'cinprogress',
+                    'cpast',
+                    'dfuture',
+                    'dinprogress',
+                    'dpast',
+                    'efuture',
+                    'einprogress',
+                    'epast'
+                ],
+                'expectednextoffset' => 15
+            ],
+            'all limit no offset' => [
+                'coursedata' => $coursedata,
+                'classification' => 'all',
+                'limit' => 5,
+                'offset' => 0,
+                'expectedcourses' => [
+                    'afuture',
+                    'ainprogress',
+                    'apast',
+                    'bfuture',
+                    'binprogress'
+                ],
+                'expectednextoffset' => 5
+            ],
+            'all limit and offset' => [
+                'coursedata' => $coursedata,
+                'classification' => 'all',
+                'limit' => 5,
+                'offset' => 5,
+                'expectedcourses' => [
+                    'bpast',
+                    'cfuture',
+                    'cinprogress',
+                    'cpast',
+                    'dfuture'
+                ],
+                'expectednextoffset' => 10
+            ],
+            'all offset past result set' => [
+                'coursedata' => $coursedata,
+                'classification' => 'all',
+                'limit' => 5,
+                'offset' => 50,
+                'expectedcourses' => [],
+                'expectednextoffset' => 50
+            ],
         ];
     }