Skip to content

Commit c41adfb

Browse files
committed
WP/CronInterval: update test comments
1 parent f3d00da commit c41adfb

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

WordPress/Tests/WP/CronIntervalUnitTest.inc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,21 +332,20 @@ add_filter( 'cron_schedules', namespace\first_class_six_min_schedule(...)); // W
332332
/*
333333
* The tests below document the current behavior of the sniff, even though they are false negatives. The sniff treats
334334
* the first-class callable examples below as if referencing the global function first_class_six_min_schedule()
335-
* and not a namespaced function with the same name. Currently, those tests don't trigger a warning but instead
336-
* they should trigger the `ChangeDetected` warning. Fixing this incorrect behavior is not trivial.
335+
* and not a namespaced function with the same name.
337336
*/
338-
add_filter( 'cron_schedules', MyNamespace\first_class_weekly_schedule(...)); // Ok: > 15 min.
339-
add_filter( 'cron_schedules', \MyNamespace\first_class_weekly_schedule(...)); // Ok: > 15 min.
337+
add_filter( 'cron_schedules', MyNamespace\first_class_weekly_schedule(...)); // False negative - Ok: > 15 min, but should be marked `ChangeDetected`.
338+
add_filter( 'cron_schedules', \MyNamespace\first_class_weekly_schedule(...)); // False negative - Ok: > 15 min, but should be marked `ChangeDetected`.
339+
add_filter( 'cron_schedules', namespace\Sub\first_class_weekly_schedule(...)); // False negative - Ok: > 15 min, but should be marked `ChangeDetected`.
340340

341341
/*
342342
* The tests below document the current behavior of the sniff, even though they are false positives. The sniff treats
343343
* the first-class callable examples below as if referencing the global function first_class_six_min_schedule()
344-
* and not a namespaced function with the same name. Currently, those tests trigger the `CronSchedulesInterval` warning
345-
* but instead they should trigger the `ChangeDetected` warning. Fixing this incorrect behavior is not trivial.
344+
* and not a namespaced function with the same name. Fixing this incorrect behavior is not trivial.
346345
*/
347-
add_filter( 'cron_schedules', MyNamespace\first_class_six_min_schedule(...)); // Warning: 6 min.
348-
add_filter( 'cron_schedules', \MyNamespace\first_class_six_min_schedule(...)); // Warning: 6 min.
349-
add_filter( 'cron_schedules', namespace\Sub\first_class_six_min_schedule(...)); // Warning: 6 min.
346+
add_filter( 'cron_schedules', MyNamespace\first_class_six_min_schedule(...)); // False positive - `CronSchedulesInterval` warning (6 min), but should be `ChangeDetected`.
347+
add_filter( 'cron_schedules', \MyNamespace\first_class_six_min_schedule(...)); // False positive - `CronSchedulesInterval` warning (6 min), but should be `ChangeDetected`.
348+
add_filter( 'cron_schedules', namespace\Sub\first_class_six_min_schedule(...)); // False positive - `CronSchedulesInterval` warning (6 min), but should be `ChangeDetected`.
350349

351350
/*
352351
* Safeguard correct handling of all types of namespaced function calls (except FQN global function call which is

WordPress/Tests/WP/CronIntervalUnitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ public function getWarningList() {
6969
328 => 1,
7070
329 => 1,
7171
330 => 1,
72+
346 => 1,
7273
347 => 1,
7374
348 => 1,
74-
349 => 1,
7575
);
7676
}
7777
}

0 commit comments

Comments
 (0)