This is my feature test
class CreateImageTest extends TestCase
{
private static function headers(){
....
}
/**
* @test
*
*/
public function no_api_key_404()
{
......
}
/**
* @test
*
*/
public function not_logged_in_401()
{
......
}
/**
* @test
*
*/
public function empty_body_422()
{
....
}
}
I've always begun the test with middleware tests like what you see above (auth and API key middleware). I'm going to use the same test procedure for endpoints with similar middleware (there are a lot of them). How can I do that without being redundant? I was thinking to make a trait for the recurring testing pattern but I have no idea how to do that.