PHP code example of protonemedia / inertiajs-events-laravel-dusk

1. Go to this page and download the library: Download protonemedia/inertiajs-events-laravel-dusk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

protonemedia / inertiajs-events-laravel-dusk example snippets




namespace Tests\Browser;

use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\DuskTestCase;

class ExampleTest extends DuskTestCase
{
    use DatabaseMigrations;

    /**
     * A basic browser test example.
     *
     * @return void
     */
    public function it_can_store_a_user_and_redirect_back_to_the_index_route()
    {
        $this->browse(function ($browser) {
            $browser->loginAs(User::first())
                    ->visit(route('user.create'))
                    ->type('name', 'New User')
                    ->press('Submit')
                    ->waitForInertiaNavigate()
                    ->assertRouteIs('user.index')
                    ->assertSee('User Added!');
        });
    }
}