This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from etahamer/main
PendingShortScheduleCommand::command method will attempt to resolve command name if class name was given
- Loading branch information
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Spatie\ShortSchedule\Tests\Unit; | ||
|
||
use Illuminate\Console\Command; | ||
use Orchestra\Testbench\TestCase as Orchestra; | ||
use ReflectionClass; | ||
use Spatie\ShortSchedule\PendingShortScheduleCommand; | ||
|
||
class PendingShortScheduleCommandTest extends Orchestra | ||
{ | ||
/** @test */ | ||
public function it_will_generate_command_from_command_class(): void | ||
{ | ||
$pendingCommand = new PendingShortScheduleCommand(); | ||
$pendingCommand->command(TestCommand::class); | ||
$reflectionClass = new ReflectionClass($pendingCommand); | ||
|
||
$commandProperty = $reflectionClass->getProperty('command'); | ||
$commandProperty->setAccessible(true); | ||
|
||
$artisanCommand = 'test-command'; | ||
$this->assertEquals(PHP_BINARY . " artisan {$artisanCommand}", $commandProperty->getValue($pendingCommand)); | ||
} | ||
} | ||
|
||
class TestCommand extends Command | ||
{ | ||
protected $signature = 'test-command'; | ||
|
||
public function handle(): void | ||
{ | ||
} | ||
} |