Skip to content

Commit

Permalink
[#353] Fix unit tests - strtotime returns incorrect month
Browse files Browse the repository at this point in the history
  • Loading branch information
Glenn Poder committed Aug 30, 2024
1 parent bf2dba1 commit df4748d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/tool_excimer_purge_page_group_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ protected function setUp(): void {
*/
public function test_purge() {
global $DB;

$cutoff = 4;
$firstofthismonth = date('Y-m') . '-01';
$months = [
monthint::from_timestamp(time()),
monthint::from_timestamp(strtotime('1 month ago')),
monthint::from_timestamp(strtotime('2 months ago')),
monthint::from_timestamp(strtotime('3 months ago')),
monthint::from_timestamp(strtotime('4 months ago')),
monthint::from_timestamp(strtotime('5 months ago')),
monthint::from_timestamp(strtotime('6 months ago')),
monthint::from_timestamp(strtotime('7 months ago')),
monthint::from_timestamp(strtotime($firstofthismonth . '1 month ago')),
monthint::from_timestamp(strtotime($firstofthismonth . '2 months ago')),
monthint::from_timestamp(strtotime($firstofthismonth . '3 months ago')),
monthint::from_timestamp(strtotime($firstofthismonth . '4 months ago')),
monthint::from_timestamp(strtotime($firstofthismonth . '5 months ago')),
monthint::from_timestamp(strtotime($firstofthismonth . '6 months ago')),
monthint::from_timestamp(strtotime($firstofthismonth . '7 months ago')),
];
foreach ($months as $month) {
$DB->insert_record(page_group::TABLE, (object) ['month' => $month, 'fuzzydurationcounts' => '']);
Expand Down

0 comments on commit df4748d

Please sign in to comment.