PHP code example of milroyfraser / pest-plugin-gwt

1. Go to this page and download the library: Download milroyfraser/pest-plugin-gwt 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/ */

    

milroyfraser / pest-plugin-gwt example snippets


use App\Exceptions\BlockedUserException;
use App\Models\User;
use function Pest\Gwt\scenario;
use function Pest\Laravel\assertDatabaseHas;

scenario('activate user')
    ->given(fn() => User::factory()->create())
    ->when(fn(User $user) => $user->activate())
    ->then(fn(User $user) => assertDatabaseHas('users', [
        'id' => $user->id,
        'activated' => true,
    ]));

scenario('activate blocked user')
    ->given(fn() => User::factory()->blocked()->create())
    ->when(fn(User $user) => $user->activate())
    ->throws(BlockedUserException::class);