From decd84699d645fd1ca037690b013114b9ad546fb Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Tue, 6 May 2025 12:12:25 +0800 Subject: [PATCH 1/2] [11.x] Fix Isolated console test. Using `__invoke()` will triggers the command to be an instance of InvokableCommand and therefore doesn't execute `Illuminate\Console\Command::execute()` method. Signed-off-by: Mior Muhammad Zaki --- tests/Console/CommandMutexTest.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/Console/CommandMutexTest.php b/tests/Console/CommandMutexTest.php index 0743e6f43e7c..ce54492fe91a 100644 --- a/tests/Console/CommandMutexTest.php +++ b/tests/Console/CommandMutexTest.php @@ -7,12 +7,15 @@ use Illuminate\Contracts\Console\Isolatable; use Illuminate\Foundation\Application; use Mockery as m; +use Orchestra\Testbench\Concerns\InteractsWithMockery; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; class CommandMutexTest extends TestCase { + use InteractsWithMockery; + /** * @var Command */ @@ -23,13 +26,15 @@ class CommandMutexTest extends TestCase */ protected $commandMutex; + /** {@inheritdoc} */ + #[\Override] protected function setUp(): void { $this->command = new class extends Command implements Isolatable { public $ran = 0; - public function __invoke() + public function handle() { $this->ran++; } @@ -42,6 +47,14 @@ public function __invoke() $this->command->setLaravel($app); } + + /** {@inheritdoc} */ + #[\Override] + protected function tearDown(): void + { + $this->tearDownTheTestEnvironmentUsingMockery(); + } + public function testCanRunIsolatedCommandIfNotBlocked() { $this->commandMutex->shouldReceive('create') From 1b865743c2ae757935f02329dac23181d32943a0 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Tue, 6 May 2025 04:14:48 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI --- tests/Console/CommandMutexTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Console/CommandMutexTest.php b/tests/Console/CommandMutexTest.php index ce54492fe91a..74abd562e542 100644 --- a/tests/Console/CommandMutexTest.php +++ b/tests/Console/CommandMutexTest.php @@ -47,7 +47,6 @@ public function handle() $this->command->setLaravel($app); } - /** {@inheritdoc} */ #[\Override] protected function tearDown(): void