Laravel 5: Testing – Laravel specific & PHPUnit testing – general info

How2s: Laravel Specific PHPUnit Testing Assertion

Laravel provides a very fluent API for making HTTP requests to your application and examining the output.
Cheatsheets
Most used Testing assertions are described here:
  1. PHPunit testing
  2. Dusk browser testing (selenium-like)

Rest of them can be found in this directory: vendor\laravel\dusk\src\Concerns\


HTTP assertions may be accessed on the response that is returned from one of HTTP methods:  POST, GET, PUT, PATCH, and DELETE.
You can specify which method you want to use:

Or use Laravel provided shortcut, like:

Above you use, if you test html page and try to make sure some stuff is present.
To test  using server actions, before they actually will get pass view(), skip get():

Also non-http assertion e.g. provided by Laravel traits may be used:

All PHPUnit docs page with all methods and annotations – see here
Please note:

Laravel allows to use all PHPunit provided assertions (and annotations). Just go to PHPunit docs, grab assertion you need and use it (as already mentioned above ) something like this: