Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567



Livewire Make Command can now Scaffold a Component Test

Livewire v2.4.0 was just released with added support for a --test option when running the php artisan livewire:make command.

The new --test option, when included, will scaffold a test class for the component in the tests/Features/Livewire directory similar to the php artisan make:test command.

php artisan livewire:make ExampleComponent --test


namespace TestsFeatureLivewire;

use AppHttpLivewireExampleComponent;
use IlluminateFoundationTestingRefreshDatabase;
use IlluminateFoundationTestingWithFaker;
use LivewireLivewire;
use TestsTestCase;

class ExampleComponentTest extends TestCase
    /** @test */
    public function the_component_can_render()
        $component = Livewire::test(ExampleComponent::class);


I’ve been working on several Livewire projects lately and creating new components every day, so I had the idea to create this option in order to save me (and other Livewire users) time. Instead of having to create a new component, then manually creating a test class, just add the --test option and start writing your tests!

Credit: Source link

Previous Next
Test Caption
Test Description goes like this