定制 endeavour-agency/refresh-database-on-demand 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

endeavour-agency/refresh-database-on-demand

最新稳定版本:1.0.0

Composer 安装命令:

composer require endeavour-agency/refresh-database-on-demand

包简介

This packages offers a drop-in replacement for Laravel's RefreshDatabase trait, which only refreshes the database when migrations have actually changed.

README 文档

README

This package offers a drop-in replacement for Laravel's RefreshDatabase trait.

Laravel's default RefreshDatabase trait always performs a migrate:fresh at the start of running a single or multiple tests, even when migrations haven't been added or deleted.

When using this package's RefreshDatabaseOnDemand trait instead, migrate:fresh will only be called when new migrations have been added or migrations have been deleted. This significantly reduces start-up time of running a single or a set of tests.

Installation

To install the package, simply require it with composer:

composer require endeavour-agency/refresh-database-on-demand

Usage

To start using the power of on-demand database refreshing, replace any occurrence of Illuminate\Foundation\Testing\RefreshDatabase with EndeavourAgency\RefreshDatabaseOnDemand\Traits\RefreshDatabaseOnDemand.

Before:

<?php
 
namespace Tests\Unit;
 
use Illuminate\Foundation\Testing\RefreshDatabase;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\Test;
 
class ExampleTest extends TestCase
{
    use RefreshDatabase;
    
    ...
}

After:

<?php
 
namespace Tests\Unit;
 
use EndeavourAgency\RefreshDatabaseOnDemand\Traits\RefreshDatabaseOnDemand;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\Test;
 
class ExampleTest extends TestCase
{
    use RefreshDatabaseOnDemand;
    
    ...
}

统计信息

  • 总下载量: 1.95k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-19