MDL-66970 analytics: Extra testing for active enrolments
authorDavid Monllaó <davidm@moodle.com>
Mon, 21 Oct 2019 00:56:10 +0000 (08:56 +0800)
committerDavid Monllaó <davidm@moodle.com>
Mon, 21 Oct 2019 21:13:26 +0000 (05:13 +0800)
I sneaked in an unrelated change to enrol-partly-active-ends-afterwards
test case as the endtime and enrolment timestart values were swapped.
The case when the enrolment start is after the analysis end is already
tested in enrol-after-end test case.

course/tests/targets_test.php

index 90a9710..7bd3148 100644 (file)
@@ -272,8 +272,8 @@ class core_analytics_targets_testcase extends advanced_testcase {
             ],
             'enrol-partly-active-ends-afterwards' => [
                 'starttime' => $now,
-                'endtime' => $now + (WEEKSECS * 9),
-                'timestart' => $now + (WEEKSECS * 10),
+                'endtime' => $now + (WEEKSECS * 10),
+                'timestart' => $now + (WEEKSECS * 9),
                 'timeend' => $now + (WEEKSECS * 11),
                 'nullcalculation' => true,
             ],
@@ -291,12 +291,33 @@ class core_analytics_targets_testcase extends advanced_testcase {
                 'timeend' => false,
                 'nullcalculation' => true,
             ],
-            'enrol-mostly-active-no-enrolment-end' => [
+            'enrol-mostly-active-no-enrolment-end-false' => [
                 'starttime' => $now,
                 'endtime' => $now + (WEEKSECS * 10),
                 'timestart' => $now + WEEKSECS,
                 'timeend' => false,
-                'nullcalculation' => true,
+                'nullcalculation' => false,
+            ],
+            'enrol-mostly-active-no-enrolment-end-zero' => [
+                'starttime' => $now,
+                'endtime' => $now + (WEEKSECS * 10),
+                'timestart' => $now + WEEKSECS,
+                'timeend' => 0,
+                'nullcalculation' => false,
+            ],
+            'enrol-no-enrolment-start-false' => [
+                'starttime' => $now,
+                'endtime' => $now + (WEEKSECS * 10),
+                'timestart' => false,
+                'timeend' => $now + (WEEKSECS * 9),
+                'nullcalculation' => false,
+            ],
+            'enrol-no-enrolment-start-zero' => [
+                'starttime' => $now,
+                'endtime' => $now + (WEEKSECS * 10),
+                'timestart' => 0,
+                'timeend' => $now + (WEEKSECS * 9),
+                'nullcalculation' => false,
             ],
             'no-start' => [
                 'starttime' => 0,