Skip to content

Commit

Permalink
Remove Every::SECOND
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed May 13, 2024
1 parent 4fb0505 commit bb31f81
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
2 changes: 0 additions & 2 deletions src/Scheduler/Every.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

enum Every
{
case SECOND;
case MINUTE;
case QUARTER;
case HALF_HOUR;
Expand All @@ -20,7 +19,6 @@ enum Every
public function toInterval(): Interval
{
return match ($this) {
self::SECOND => new Interval(seconds: 1),
self::MINUTE => new Interval(minutes: 1),
self::QUARTER => new Interval(minutes: 15),
self::HALF_HOUR => new Interval(minutes: 30),
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/ScheduledCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public function __construct(
) {
}

#[Schedule(Every::SECOND)]
#[Schedule(Every::MINUTE)]
#[ConsoleCommand('scheduled')]
public function command(): void
{
$this->console->writeln('A command got scheduled');
}

#[Schedule(Every::SECOND)]
#[Schedule(Every::MINUTE)]
public function method(): void
{
$this->console->writeln('A method got scheduled');
Expand Down
9 changes: 0 additions & 9 deletions tests/Scheduler/EveryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
*/
final class EveryTest extends TestCase
{
public function test_every_second_gets_transformed_to_interval()
{
$every = Every::SECOND;
$interval = $every->toInterval();

$this->assertSame(1, $interval->seconds);
$this->assertSame(1, $interval->inSeconds());
}

public function test_every_minute_gets_transformed_to_interval()
{
$every = Every::MINUTE;
Expand Down
4 changes: 2 additions & 2 deletions tests/Scheduler/GenericSchedulerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function test_scheduler_executes_handlers()
$config = new SchedulerConfig();
$config->addMethodInvocation(
new ReflectionMethod($this, 'handler'),
new Schedule(Every::SECOND)
new Schedule(Every::MINUTE)
);

$scheduler = new GenericScheduler($config, $executor);
Expand All @@ -60,7 +60,7 @@ public function test_scheduler_executes_commands()
$config->addCommandInvocation(
new ReflectionMethod($this, 'command'),
new ConsoleCommand('command'),
new Schedule(Every::SECOND)
new Schedule(Every::MINUTE)
);

$scheduler = new GenericScheduler($config, $executor);
Expand Down

0 comments on commit bb31f81

Please sign in to comment.