zenstruck / browser

A fluent interface for your Symfony functional tests.
MIT License
190 stars 18 forks source link

Add authentication assertions to `KernelBrowser` #84

Closed kbond closed 2 years ago

kbond commented 2 years ago
use Zenstruck\Browser\Component\Auth;

$this->browser()
    ->visit('/some/page')

    // fail if authenticated
    ->assertNotAuthenticated()

    ->actingAs($user)

    // fail if NOT authenticated
    ->assertAuthenticated()

    // fail if NOT authenticated or authenticated as a user other than "kevin"
    ->assertAuthenticated('kevin')
;