I want to write tests for Laravel app (version 11.20.0).
I just made a dummy first test which looks like this:
use App\Domain\SplicingPurchaseOrder\Models\SplicingPurchaseOrder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class SplicingPurchaseOrderTransitionTest extends TestCase
{
use RefreshDatabase;
public function testInProcessOrderStaysInProcess(): void
{
$this->assertEquals(0, SplicingPurchaseOrder::all()->count());
}
}
When I ran php artisan test --filter testInProcessOrderStaysInProcess
The whole database got emptied, every table in the database.
I did similar tests before on another project and there the tests worked as expected: entries created during the test got deleted after tests ran but all the other entries in database were left intact.
What am I missing?
How to achieve testing so that only entries created during testing would be deleted?