public function tearDown()
{
$this->browse(function (Browser $browser) {
$browser->click('#navbarDropdown')
->click('.dropdown-item');
});
parent::tearDown();
}
When I apply the tearDown() method to my test class I get an error telling me the tearDown() must be compatible with Illuminate\Foundation\Testing\TestCase::tearDown()
What am I doing wrong?
Every time I run a test I need to login. I want to login in the setUp() method and the log out again in the tearDown, so I can execute my tests independently.
This is my setUp() method
use databaseMigrations;
public function setUp(): void
{
parent::setUp();
$this->seed('DatabaseSeeder');
$this->browse(function (Browser $browser) {
$browser->visit('/admin')
->type('email', 'admin@admin.com')
->type('password', 'admin')
->press('Login');
});
}
The setUp() method works just fine. Even when I don't add any code to the tearDown() method, except the parent::tearDown();
, I get an error, so what am I doing wrong in my tearDown() method?
public function tearDown()
{
parent::tearDown();
}