zenstruck / browser

A fluent interface for your Symfony functional tests.
MIT License
186 stars 17 forks source link

Expect exception #78

Closed kbond closed 2 years ago

kbond commented 2 years ago

Closes #46.

$browser
    ->expectException(SomeException::class) // auto-enables ->throwExceptions() for the next request
    ->post('/some/url') // fail if SomeException wasn't thrown

    ->expectException(SomeException::class, 'expected exception message')
    ->click('link or button') // fail if SomeException wasn't thrown or message doesn't match
;