PHPackages                             ezitisitis/laravel-refresh-database-once - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ezitisitis/laravel-refresh-database-once

AbandonedArchivedLibrary

ezitisitis/laravel-refresh-database-once
========================================

1.2.1(1y ago)0425MITPHPPHP ^8.2

Since Feb 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ezitisitis/laravel-refresh-database-once)[ Packagist](https://packagist.org/packages/ezitisitis/laravel-refresh-database-once)[ Fund](https://buymeacoffee.com/ezitisitis)[ GitHub Sponsors](https://github.com/sponsors/ezitisitis)[ RSS](/packages/ezitisitis-laravel-refresh-database-once/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

Laravel DB refresh
==================

[](#laravel-db-refresh)

**⚠️ Notice: This project is no longer maintained. As a replacement please use [RefreshDatabase](https://laravel.com/docs/12.x/database-testing#resetting-the-database-after-each-test).**

This package contains Trait to refresh and seed database before running test scope.

Why do you need that
--------------------

[](#why-do-you-need-that)

When you work in local environment. It sometimes appears that you want to run tests agains clean database (for example you have record count somewhere in tests). Running each test on clear database is bad idea in general, because:

1. You check only that your code works only when there is no records;
2. **It is insanely time consuming**;

Installing
----------

[](#installing)

1. `composer require --dev ezitisitis/laravel-refresh-database-once`;
2. Add `MigrateFreshSeedOnce` use to `TestCase` class;
3. Congratulations, you are done.

Example:

```
