Home API Tools Posts Hire Me About
Sign In Create Account
Livewire

Testing Livewire v4 with Pest v4

February 01, 2026 1 min read 39 views

Livewire v4 integrates with Pest v4 for real browser-based testing.

Setup

composer require pestphp/pest --dev
php artisan pest:install

Component Test

it('increments the counter', function () {
    Livewire::test(Counter::class)
        ->assertSee('Count: 0')
        ->call('increment')
        ->assertSee('Count: 1');
});

it('validates input', function () {
    Livewire::test(CreatePost::class)
        ->set('title', '')
        ->call('save')
        ->assertHasErrors(['title' => 'required']);
});
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!