Skip to content

Conversation

@damsfx
Copy link
Contributor

@damsfx damsfx commented Aug 28, 2025

Summary by CodeRabbit

  • New Features

    • Three new Artisan scheduling commands now available for managing scheduled tasks.
  • Tests

    • Comprehensive test coverage added for the new scheduling commands, validating various scenarios including empty schedules, detailed output formatting, sorted results, and verbose modes.

✏️ Tip: You can customize this high-level summary in your review settings.

@damsfx
Copy link
Contributor Author

damsfx commented Aug 29, 2025

@LukeTowers I can't figure out why the “Code Analysis” test fails. I haven't made any changes to the concerned file, and locally the test passes without error.

@LukeTowers
Copy link
Member

@bennothommo can you take a look at this? Not sure what is going on here.

@damsfx
Copy link
Contributor Author

damsfx commented Jan 24, 2026

@LukeTowers @bennothommo Any news??
I have several projects with massif use of scheduled commands, and it would really be a plus to be able to control scheduling with the command php artisan schedule:list.`

@LukeTowers LukeTowers added this to the 1.2.10 milestone Jan 24, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Walkthrough

This PR registers three new Artisan schedule commands (ScheduleList, ScheduleTest, ScheduleWork) in the service provider and adds comprehensive test coverage for the ScheduleListCommand and ScheduleTestCommand functionality across various scenarios.

Changes

Cohort / File(s) Summary
Service Provider Registration
src/Foundation/Providers/ArtisanServiceProvider.php
Enabled three schedule-related Artisan commands by adding mappings to $commands property: ScheduleList, ScheduleTest, and ScheduleWork command registrations
Schedule Command Tests
tests/Scheduling/ScheduleListCommandTest.php
Added comprehensive test suite for ScheduleListCommand with test methods covering empty schedules, basic schedule display, sorted output, and verbose mode; includes test doubles for commands, jobs, and callables
Schedule Test Command Tests
tests/Scheduling/ScheduleTestCommandTest.php
Added test suite for ScheduleTestCommand with scenarios for no defined commands, no matching command, name-based execution, and interactive choice selection; includes command and job stub implementations

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Register schedule commands' directly and clearly describes the main change: registering three schedule-related Artisan commands (ScheduleList, ScheduleTest, ScheduleWork) in the ArtisanServiceProvider.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wintercms wintercms deleted a comment from github-actions bot Jan 24, 2026
@wintercms wintercms deleted a comment from github-actions bot Jan 24, 2026
@LukeTowers LukeTowers merged commit 637a4a6 into wintercms:develop Jan 24, 2026
10 of 11 checks passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@tests/Scheduling/ScheduleListCommandTest.php`:
- Around line 100-105: In ScheduleListCommandTest::tearDown() add cleanup to
reset Carbon's mocked time by calling Carbon::setTestNow(null) (or
Carbon::setTestNow()) before calling parent::tearDown(), so the frozen time set
in setUp() doesn't leak into other tests; keep the existing
putenv('SHELL_VERBOSITY') call and ensure you import/use Carbon\Carbon or
reference it fully when adding the reset.
- Around line 119-123: PHPMD flags the constructor parameter in class
FooParamJob as unused; add a PHPMD suppression docblock to the constructor to
silence the warning. Locate the FooParamJob class and its __construct($param)
method and add a docblock like /**
`@SuppressWarnings`(PHPMD.UnusedFormalParameter) */ immediately above the
__construct definition so the unused-parameter warning is suppressed for this
test stub.

Comment on lines +100 to +105
protected function tearDown(): void
{
putenv('SHELL_VERBOSITY');

parent::tearDown();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Reset Carbon test time to avoid cross-test leakage.

setUp() freezes time; without clearing it, other tests can inherit the mocked clock.

✅ Add cleanup in tearDown()
 protected function tearDown(): void
 {
+    Carbon::setTestNow(null);
     putenv('SHELL_VERBOSITY');

     parent::tearDown();
 }
🤖 Prompt for AI Agents
In `@tests/Scheduling/ScheduleListCommandTest.php` around lines 100 - 105, In
ScheduleListCommandTest::tearDown() add cleanup to reset Carbon's mocked time by
calling Carbon::setTestNow(null) (or Carbon::setTestNow()) before calling
parent::tearDown(), so the frozen time set in setUp() doesn't leak into other
tests; keep the existing putenv('SHELL_VERBOSITY') call and ensure you
import/use Carbon\Carbon or reference it fully when adding the reset.

Comment on lines +119 to +123
class FooParamJob
{
public function __construct($param)
{
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Suppress PHPMD unused-parameter warning for the stub.

PHPMD flags $param as unused; this can fail code analysis if tests are included.

🔧 Suppress the unused-parameter warning
 class FooParamJob
 {
+    /**
+     * `@SuppressWarnings`(PHPMD.UnusedFormalParameter)
+     */
     public function __construct($param)
     {
     }
 }
🧰 Tools
🪛 PHPMD (2.15.0)

121-121: Avoid unused parameters such as '$param'. (undefined)

(UnusedFormalParameter)

🤖 Prompt for AI Agents
In `@tests/Scheduling/ScheduleListCommandTest.php` around lines 119 - 123, PHPMD
flags the constructor parameter in class FooParamJob as unused; add a PHPMD
suppression docblock to the constructor to silence the warning. Locate the
FooParamJob class and its __construct($param) method and add a docblock like /**
`@SuppressWarnings`(PHPMD.UnusedFormalParameter) */ immediately above the
__construct definition so the unused-parameter warning is suppressed for this
test stub.

@damsfx
Copy link
Contributor Author

damsfx commented Jan 24, 2026

Thanks a lot @LukeTowers !!
Impatient to see this PR merged into branch v1.3 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants