PHPackages                             betapeak/laravel-testing-helper-traits - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. betapeak/laravel-testing-helper-traits

ActivePackage[Testing &amp; Quality](/categories/testing)

betapeak/laravel-testing-helper-traits
======================================

Adds traits similar to the DatabaseMigtaions trait, but with added seeding.

1.0.1(8y ago)112MITPHPPHP &gt;=7.0

Since Oct 31Pushed 8y ago1 watchersCompare

[ Source](https://github.com/betapeak/laravel-testing-helper-traits)[ Packagist](https://packagist.org/packages/betapeak/laravel-testing-helper-traits)[ RSS](/packages/betapeak-laravel-testing-helper-traits/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

The included trait provides additional features on top of the existing `DatabaseMigrations` trait currently included with Laravel:

- Using 'migrate:refresh' instead of the hardcoded 'migrate:fresh' by including a property on your test class

```
protected $useRefreshMigrations = true;

```

- Using custom seeders which can be defined separately for each test

```
protected $seederClass = 'AnotherDatabaseSeeder';

```

### Installation

[](#installation)

This package requires that you are using `laravel/framework: 5.5.*`. Provided this is fulfilled, you can install the helper traits like so:

```
composer require betapeak/laravel-testing-helper-traits

```

### Usage

[](#usage)

You can use the included `DatabaseMigrationsWithSeeding` trait in place of the existing `DatabaseMigrations` trait included in Laravel. Like the default trait, it will `migrate:fresh` the database, but will also seed it with the default `DatabaseSeeder` class.

```
namespace Tests;
use BetaPeak\Testing\Traits\DatabaseMigrationsWithSeeding;

class SomeUnitTest extends TestCase
{
    use DatabaseMigrationsWithSeeding;

    /** @test */
    public function it_tests_something()
    {
        //Test something
    }

}

```

You can specify a different seeder class like so:

```
namespace Tests;
use BetaPeak\Testing\Traits\DatabaseMigrationsWithSeeding;

class SomeUnitTest extends TestCase
{
    use DatabaseMigrationsWithSeeding;

    protected $seederClass = 'AnotherSeederClass';

    ...

}

```

Finally, if you don't want to use `migrate:fresh`, you can force the trait to use `migrate:refresh` like so:

```
namespace Tests;
use BetaPeak\Testing\Traits\DatabaseMigrationsWithSeeding;

class SomeUnitTest extends TestCase
{
    use DatabaseMigrationsWithSeeding;

    protected $useRefreshMigrations = true;

    ...

}

```

More information on using database migrations in tests can be found on [Laravel's homepage](https://laravel.com/docs/5.5/database-testing)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

3117d ago

Major Versions

0.2 → 1.02017-10-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c778dda35b2abb440837a7dd053a3e53994202a61c51b04e570c69be3d8baeb?d=identicon)[ymslavov](/maintainers/ymslavov)

---

Top Contributors

[![ymslavov](https://avatars.githubusercontent.com/u/6988950?v=4)](https://github.com/ymslavov "ymslavov (3 commits)")

---

Tags

testinglaraveltraits

### Embed Badge

![Health badge](/badges/betapeak-laravel-testing-helper-traits/health.svg)

```
[![Health](https://phpackages.com/badges/betapeak-laravel-testing-helper-traits/health.svg)](https://phpackages.com/packages/betapeak-laravel-testing-helper-traits)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[hotmeteor/spectator

Testing helpers for your OpenAPI spec

3021.4M1](/packages/hotmeteor-spectator)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8017.0M43](/packages/orchestra-workbench)[guanguans/laravel-soar

SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。

2227.8k](/packages/guanguans-laravel-soar)[spurwork/spectator

Testing helpers for your OpenAPI spec

3021.5k](/packages/spurwork-spectator)[sofa/laravel-kahlan

Kahlan specs suite for testing Laravel applications

1524.2k](/packages/sofa-laravel-kahlan)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
