I have a code that runs everyday and deletes some information from the database.
I am trying to test this code using artisan's test functionality and would like to be able to see the final result on phpmyadmin, however if I add Illuminate\Foundation\Testing\RefreshDatabase
The DB seems to refresh at the start AND at the end.
Is there a way to refresh the database at the start only?
Here is a shortened sample of my code:
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Server\Models\User;
use Server\Models\...; //call multiple models
use Tests\TestCase;
class TestRemoveCertainData extends TestCase
{
use RefreshDatabase;
public function removeCertainData()
{
//create all necessary data using factory
factory(User::class)->create(); // etc...
//should run the code that deletes certain data
$this->artisan('remove_data_command')->assertSuccessful();
}
}
So after I run php artisan test Tests\Feature\TestRemoveCertainData
I would like to check if php artisan remove_data_command
worked the way I intended it to on the phpmyadmin panel.