Skip to content

Commit

Permalink
Merge branch '7.1' into 7.2
Browse files Browse the repository at this point in the history
* 7.1:
  fix: notifier push channel bus abstract arg
  [Scheduler] remove dead code
  • Loading branch information
nicolas-grekas committed Dec 7, 2024
2 parents 38a0d1e + 571e659 commit 38b8c09
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 56 deletions.
10 changes: 2 additions & 8 deletions Tests/RecurringMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Scheduler\Tests;

use PHPUnit\Framework\TestCase;
use Random\Randomizer;
use Symfony\Component\Scheduler\Exception\InvalidArgumentException;
use Symfony\Component\Scheduler\RecurringMessage;

Expand All @@ -22,13 +21,8 @@ public function testCanCreateHashedCronMessage()
{
$object = new DummyStringableMessage();

if (class_exists(Randomizer::class)) {
$this->assertSame('30 0 * * *', (string) RecurringMessage::cron('#midnight', $object)->getTrigger());
$this->assertSame('30 0 * * 3', (string) RecurringMessage::cron('#weekly', $object)->getTrigger());
} else {
$this->assertSame('36 0 * * *', (string) RecurringMessage::cron('#midnight', $object)->getTrigger());
$this->assertSame('36 0 * * 6', (string) RecurringMessage::cron('#weekly', $object)->getTrigger());
}
$this->assertSame('30 0 * * *', (string) RecurringMessage::cron('#midnight', $object)->getTrigger());
$this->assertSame('30 0 * * 3', (string) RecurringMessage::cron('#weekly', $object)->getTrigger());
}

public function testHashedCronContextIsRequiredIfMessageIsNotStringable()
Expand Down
69 changes: 21 additions & 48 deletions Tests/Trigger/CronExpressionTriggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Scheduler\Tests\Trigger;

use PHPUnit\Framework\TestCase;
use Random\Randomizer;
use Symfony\Component\Scheduler\Trigger\CronExpressionTrigger;

class CronExpressionTriggerTest extends TestCase
Expand All @@ -33,54 +32,28 @@ public function testHashedExpressionParsing(string $input, string $expected)

public static function hashedExpressionProvider(): array
{
if (class_exists(Randomizer::class)) {
return [
['# * * * *', '30 * * * *'],
['# # * * *', '30 0 * * *'],
['# # # * *', '30 0 25 * *'],
['# # # # *', '30 0 25 10 *'],
['# # # # #', '30 0 25 10 5'],
['# # 1,15 1-11 *', '30 0 1,15 1-11 *'],
['# # 1,15 * *', '30 0 1,15 * *'],
['#hourly', '30 * * * *'],
['#daily', '30 0 * * *'],
['#weekly', '30 0 * * 3'],
['#weekly@midnight', '30 0 * * 3'],
['#monthly', '30 0 25 * *'],
['#monthly@midnight', '30 0 25 * *'],
['#yearly', '30 0 25 10 *'],
['#yearly@midnight', '30 0 25 10 *'],
['#annually', '30 0 25 10 *'],
['#annually@midnight', '30 0 25 10 *'],
['#midnight', '30 0 * * *'],
['#(1-15) * * * *', '1 * * * *'],
['#(1-15) * * * #(3-5)', '1 * * * 3'],
['#(1-15) * # * #(3-5)', '1 * 17 * 5'],
];
}

return [
['# * * * *', '36 * * * *'],
['# # * * *', '36 0 * * *'],
['# # # * *', '36 0 14 * *'],
['# # # # *', '36 0 14 3 *'],
['# # # # #', '36 0 14 3 5'],
['# # 1,15 1-11 *', '36 0 1,15 1-11 *'],
['# # 1,15 * *', '36 0 1,15 * *'],
['#hourly', '36 * * * *'],
['#daily', '36 0 * * *'],
['#weekly', '36 0 * * 6'],
['#weekly@midnight', '36 0 * * 6'],
['#monthly', '36 0 14 * *'],
['#monthly@midnight', '36 0 14 * *'],
['#yearly', '36 0 14 3 *'],
['#yearly@midnight', '36 0 14 3 *'],
['#annually', '36 0 14 3 *'],
['#annually@midnight', '36 0 14 3 *'],
['#midnight', '36 0 * * *'],
['#(1-15) * * * *', '7 * * * *'],
['#(1-15) * * * #(3-5)', '7 * * * 3'],
['#(1-15) * # * #(3-5)', '7 * 1 * 5'],
['# * * * *', '30 * * * *'],
['# # * * *', '30 0 * * *'],
['# # # * *', '30 0 25 * *'],
['# # # # *', '30 0 25 10 *'],
['# # # # #', '30 0 25 10 5'],
['# # 1,15 1-11 *', '30 0 1,15 1-11 *'],
['# # 1,15 * *', '30 0 1,15 * *'],
['#hourly', '30 * * * *'],
['#daily', '30 0 * * *'],
['#weekly', '30 0 * * 3'],
['#weekly@midnight', '30 0 * * 3'],
['#monthly', '30 0 25 * *'],
['#monthly@midnight', '30 0 25 * *'],
['#yearly', '30 0 25 10 *'],
['#yearly@midnight', '30 0 25 10 *'],
['#annually', '30 0 25 10 *'],
['#annually@midnight', '30 0 25 10 *'],
['#midnight', '30 0 * * *'],
['#(1-15) * * * *', '1 * * * *'],
['#(1-15) * * * #(3-5)', '1 * * * 3'],
['#(1-15) * # * #(3-5)', '1 * 17 * 5'],
];
}

Expand Down

0 comments on commit 38b8c09

Please sign in to comment.