Hi i try to make a command to test my site and display this in a blade:
my Livewire/Test.php
<?php
namespace Leeuwenkasteel\Install\Http\Livewire;
use Livewire\Component;
use Artisan;
class Test extends Component{
public $output = '';
public function runUnitTest(){
$result = Artisan::call('test');
$this->output = Artisan::output();
}
public function render()
{
return view('installer::livewire.test');
}
}
My Testscript
<?php
namespace Modules\Auth\Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class AuthTest extends TestCase{
public function testExample(){
$this->assertTrue(true);
}
}
Use the Artisan::queue method instead of the Artisan::call method to run the test command. This will run the command in the background using a queue worker, which should have access to the $argv variable.
public function runUnitTest()
{
Artisan::queue('test');
$this->output = 'Tests have been queued for execution.';
}