jeudi 17 mai 2018

Laravel - custom setUp method only in parent class - Testing

My test's custom setUp method looks like this:

protected function setUp()
{
    parent::setUp();
    $this->withoutMiddleware([VerifyCsrfToken::class]);
    $this->followingRedirects();
}

I have a class of MyTestCase that extends the default laravel's TestCase

abstract class MyTestCase extends TestCase

I have pushed up many methods and traits use.

But I cannot push this one setUp method. After that everything blows up.

Is it possible to have this setUp method I showed you at the beginning only in my MyTestCase?

Because now I have to duplicate this setUp method in all of my test's classes in order them to work.

Aucun commentaire:

Enregistrer un commentaire