使用時機
Laravel の新機能またはエンドポイント
affaan-m/ECC
Review laravel-tdd's use cases, installation, workflow, and original source instructions.
npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/laravel-tdd"Source checked Jul 28, 2026·Refresh due Oct 26, 2026
Reorganized from the pinned upstream SKILL.md
PHPUnit と Pest を使用した Laravel アプリケーション用のテスト駆動開発。80%+ カバレッジ(ユニット + フィーチャー)。
npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/laravel-tdd"The pinned source supports a structured brief, but not an expanded tutorial. Only detected inputs, outputs, and sections are shown.
467 source words · 22 usable sections
Documentation workflow
Sections are extracted automatically from the pinned SKILL.md and link back to the source.
Laravel の新機能またはエンドポイント
1) テスト失敗を書く 2) 最小限の変更を実装して合格させる 3) テストを緑に保ちながらリファクタリング
1) テスト失敗を書く 2) 最小限の変更を実装して合格させる 3) テストを緑に保ちながらリファクタリング
ユニット:純粋な PHP クラス、値オブジェクト、サービス
Documentation checklist
The source section “使用時機” has been checked.
The source section “仕組み” has been checked.
The source section “RED-GREEN-REFACTOR サイクル” has been checked.
The source section “テスト層” has been checked.
Choose a different workflow
Laravel testing strategies with PHPUnit, Pest, model factories, HTTP tests, Sanctum authentication testing, mocking, and coverage.
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailTest-driven development for Laravel with PHPUnit and Pest, factories, database testing, fakes, and coverage targets.
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailDesarrollo guiado por pruebas para Laravel con PHPUnit y Pest, factories, pruebas de base de datos, fakes y objetivos de cobertura.
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailFAQ
PHPUnit と Pest を使用した Laravel アプリケーション用のテスト駆動開発。80%+ カバレッジ(ユニット + フィーチャー)。
The source record exposes this install command: npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/laravel-tdd". Inspect the command and pinned source before running it.
Quality breakdown
Based on traceable docs and repository signals; stars are not treated as quality.
Compare before choosing
These links are selected from shared tasks, functions, stacks, platforms, and same-name variants. Compare the source owner, documentation, permissions, and maintenance signals.
Laravel testing strategies with PHPUnit, Pest, model factories, HTTP tests, Sanctum authentication testing, mocking, and coverage.
Test-driven development for Laravel with PHPUnit and Pest, factories, database testing, fakes, and coverage targets.
Desarrollo guiado por pruebas para Laravel con PHPUnit y Pest, factories, pruebas de base de datos, fakes y objetivos de cobertura.
Review laravel-tdd's use cases, installation, workflow, and original source instructions.
PHPUnit と Pest を使用した Laravel アプリケーション用のテスト駆動開発。80%+ カバレッジ(ユニット + フィーチャー)。
スコープに基づいて層を選択:
RefreshDatabase ほとんどのフィーチャー/統合テスト用(テスト実行ごとにマイグレーションを 1 回実行し、次に各テストをトランザクション内でラップ;メモリ内データベースは各テストごとに再マイグレーションする可能性がある)DatabaseTransactions スキーマがすでにマイグレーションされており、テストごとのロールバックのみが必要なときDatabaseMigrations すべてのテストで完全な migrate/fresh が必要なとき、またはコストを負担できるときRefreshDatabase をデータベースに触れるテストのデフォルトとして使用:トランザクション サポート付きデータベースの場合、マイグレーション ステップ フラグを使用して テスト実行ごとに 1 回実行し、次に各テストをトランザクション内でラップします;:memory: SQLite または非トランザクションの接続では、各テストの前にマイグレーションします。スキーマがすでにマイグレーションされており、テストごとのロールバックのみが必要なときは DatabaseTransactions を使用します。
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
final class ProjectControllerTest extends TestCase
{
use RefreshDatabase;
public function test_owner_can_create_project(): void
{
$user = User::factory()->create();
$response = $this->actingAs($user)->postJson('/api/projects', [
'name' => 'New Project',
]);
$response->assertCreated();
$this->assertDatabaseHas('projects', ['name' => 'New Project']);
}
}
use App\Models\Project;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
final class ProjectIndexTest extends TestCase
{
use RefreshDatabase;
public function test_projects_index_returns_paginated_results(): void
{
$user = User::factory()->create();
Project::factory()->count(3)->for($user)->create();
$response = $this->actingAs($user)->getJson('/api/projects');
$response->assertOk();
$response->assertJsonStructure(['success', 'data', 'error', 'meta']);
}
}
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use function Pest\Laravel\actingAs;
use function Pest\Laravel\assertDatabaseHas;
uses(RefreshDatabase::class);
test('owner can create project', function () {
$user = User::factory()->create();
$response = actingAs($user)->postJson('/api/projects', [
'name' => 'New Project',
]);
$response->assertCreated();
assertDatabaseHas('projects', ['name' => 'New Project']);
});
use App\Models\Project;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use function Pest\Laravel\actingAs;
uses(RefreshDatabase::class);
test('projects index returns paginated results', function () {
$user = User::factory()->create();
Project::factory()->count(3)->for($user)->create();
$response = actingAs($user)->getJson('/api/projects');
$response->assertOk();
$response->assertJsonStructure(['success', 'data', 'error', 'meta']);
});
$user = User::factory()->state(['role' => 'admin'])->create();
RefreshDatabase を使用assertDatabaseHas を優先use App\Models\Project;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
final class ProjectRepositoryTest extends TestCase
{
use RefreshDatabase;
public function test_project_can_be_retrieved_by_slug(): void
{
$project = Project::factory()->create(['slug' => 'alpha']);
$found = Project::query()->where('slug', 'alpha')->firstOrFail();
$this->assertSame($project->id, $found->id);
}
}
Bus::fake() ジョブ用Queue::fake() キュー作業用Mail::fake() と Notification::fake() 通知用Event::fake() ドメインイベント用use Illuminate\Support\Facades\Queue;
Queue::fake();
dispatch(new SendOrderConfirmation($order->id));
Queue::assertPushed(SendOrderConfirmation::class);
use Illuminate\Support\Facades\Notification;
Notification::fake();
$user->notify(new InvoiceReady($invoice));
Notification::assertSentTo($user, InvoiceReady::class);
use Laravel\Sanctum\Sanctum;
Sanctum::actingAs($user);
$response = $this->getJson('/api/projects');
$response->assertOk();
Http::fake() を使用して外部 API を隔離Http::assertSent() で送信ペイロードをアサートpcov または XDEBUG_MODE=coverage を使用php artisan testvendor/bin/phpunitvendor/bin/pestphpunit.xml を使用して DB_CONNECTION=sqlite と DB_DATABASE=:memory: を設定して高速テストuse Illuminate\Support\Facades\Gate;
$this->assertTrue(Gate::forUser($user)->allows('update', $project));
$this->assertFalse(Gate::forUser($otherUser)->allows('update', $project));
Inertia.js 使用時、Inertia テスティングヘルパーでコンポーネント名とプロップをアサート。
use App\Models\User;
use Inertia\Testing\AssertableInertia;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
final class DashboardInertiaTest extends TestCase
{
use RefreshDatabase;
public function test_dashboard_inertia_props(): void
{
$user = User::factory()->create();
$response = $this->actingAs($user)->get('/dashboard');
$response->assertOk();
$response->assertInertia(fn (AssertableInertia $page) => $page
->component('Dashboard')
->where('user.id', $user->id)
->has('projects')
);
}
}
生の JSON アサーションより assertInertia を優先して、テストを Inertia レスポンスに合わせておく。