affaan-m/ECC

laravel-tdd

Test-driven development for Laravel with PHPUnit and Pest, factories, database testing, fakes, and coverage targets.

75Collecting
See how to use itView GitHub source
npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/laravel-tdd"
Automated source guide

Source checked Jul 28, 2026·Refresh due Oct 26, 2026

Reorganized from the pinned upstream SKILL.md

Turn laravel-tdd's source instructions into a guide you can follow

According to the pinned SKILL.md from affaan-m/ECC: 80%+ kapsam (unit + feature) ile Laravel uygulamaları için test-driven development.

npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/laravel-tdd"
Check the pinned source

Best fit

  • Test-driven development for Laravel with PHPUnit and Pest, factories, database testing, fakes, and coverage targets.

Bring this context

  • A concrete task that matches the documented purpose of laravel-tdd.
  • The files, examples, or context the task depends on.
  • Your constraints, target environment, and definition of done.

Expected outputs

  • A result that follows the pinned laravel-tdd instructions.
  • A concise record of assumptions, inputs used, and unresolved questions.
  • A final check against the source workflow and relevant permission signals.

Key source sections

Read laravel-tdd through these 5 source sections

Sections are extracted automatically from the pinned SKILL.md and link back to the source.

01

Ne Zaman Kullanılır

Laravel'de yeni özellikler veya endpoint'ler

SKILL.md · Ne Zaman Kullanılır
Laravel'de yeni özellikler veya endpoint'lerBug düzeltmeleri veya refactoring'lerEloquent model'leri, policy'leri, job'ları ve notification'ları test etme
02

Nasıl Çalışır

1) Başarısız bir test yazın 2) Geçmek için minimal değişiklik uygulayın 3) Testleri yeşil tutarken refactor edin

SKILL.md · Nasıl Çalışır
Başarısız bir test yazınGeçmek için minimal değişiklik uygulayınTestleri yeşil tutarken refactor edin
03

Red-Green-Refactor Döngüsü

1) Başarısız bir test yazın 2) Geçmek için minimal değişiklik uygulayın 3) Testleri yeşil tutarken refactor edin

SKILL.md · Red-Green-Refactor Döngüsü
Başarısız bir test yazınGeçmek için minimal değişiklik uygulayınTestleri yeşil tutarken refactor edin
04

Test Katmanları

Kapsama göre katmanları seçin:

SKILL.md · Test Katmanları
Unit: saf PHP sınıfları, value object'leri, servislerFeature: HTTP endpoint'leri, auth, validation, policy'lerIntegration: database + kuyruk + harici sınırlar
05

Database Stratejisi

Veritabanına dokunan testler için varsayılan olarak RefreshDatabase kullanın: transaction desteği olan veritabanları için, test run'ı başına bir kez (static bir bayrak aracılığıyla) migration'ları çalıştırır ve her testi bir transaction'a sarar; :memory: SQLite veya transaction'…

SKILL.md · Database Stratejisi
Çoğu feature/integration testi için RefreshDatabase (test run'ı başına bir kez migration'ları çalıştırır, ardından desteklendiğinde her testi bir transaction'a sarar; in-memory veritabanları test başına yeniden migrate…Şema zaten migrate edilmişse ve sadece test başına rollback'e ihtiyacınız varsa DatabaseTransactionsHer test için tam bir migrate/fresh'e ihtiyacınız varsa ve maliyetini karşılayabiliyorsanız DatabaseMigrations

SkillSignal prompt templates

Provide the task, context, and acceptance criteria

These prompts were written by SkillSignal from the source structure; they are not upstream text.

Task-start prompt

Confirm source fit, inputs, and outputs before acting.

Use laravel-tdd to help me with: [specific task]. Context: [files, data, or background]. Constraints: [environment, scope, and prohibited actions]. Before acting, check the pinned SKILL.md and explain which sections apply, what inputs are still missing, and what you will deliver.

Source-guided execution

Make the Agent explicitly follow the key extracted sections.

Apply the pinned laravel-tdd source to [task]. Pay particular attention to these source sections: “Ne Zaman Kullanılır”, “Nasıl Çalışır”, “Red-Green-Refactor Döngüsü”, “Test Katmanları”, “Database Stratejisi”. Preserve the important decision at each step. Mark facts not covered by the source as “needs confirmation” instead of inventing them. Then verify the result against my acceptance criteria: [criteria].

Result-review prompt

Check omissions, permissions, and source drift before delivery.

Review the current laravel-tdd result: (1) does it satisfy the original task; (2) were any applicable steps or limits in the pinned SKILL.md missed; (3) did it perform any unauthorized file, command, network, or data action; and (4) which conclusions remain unverified? List issues first, then fix only what the source or user authorization supports.

Output checklist

Verify each item before delivery

The task matches the purpose documented in the SKILL.md.

The source section “Ne Zaman Kullanılır” has been checked.

The source section “Nasıl Çalışır” has been checked.

The source section “Red-Green-Refactor Döngüsü” has been checked.

The source section “Test Katmanları” has been checked.

Inputs, constraints, and acceptance criteria are explicit.

Unverified facts, compatibility, and outcome claims are clearly marked.

Any file, command, network, or data action has been reviewed.

Choose a different workflow

When another Skill is the better fit

FAQ

What does laravel-tdd do?

80%+ kapsam (unit + feature) ile Laravel uygulamaları için test-driven development.

How do I start using laravel-tdd?

The catalog detected this source-specific install command: npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/laravel-tdd". Inspect the command and pinned source before running it.

Which Agent platforms does it declare?

No dedicated Agent platform is declared in the pinned source record.

Repository stars
234,327
Repository forks
35,711
Quality
75/100
Source repository last pushed

Quality breakdown

Based on traceable docs and repository signals; stars are not treated as quality.

75/100
Documentation23/30
Specificity20/25
Maintenance20/20
Trust signals12/25

Compare before choosing

Related Agent Skills and source variants

These links are selected from shared tasks, functions, stacks, platforms, and same-name variants. Compare the source owner, documentation, permissions, and maintenance signals.

View original Skill.mdThis page is parsed directly from the repository SKILL.md without editorial rewriting. Collected: Jul 28, 2026 · about 2 min

Laravel TDD İş Akışı

80%+ kapsam (unit + feature) ile Laravel uygulamaları için test-driven development.

Ne Zaman Kullanılır

  • Laravel'de yeni özellikler veya endpoint'ler
  • Bug düzeltmeleri veya refactoring'ler
  • Eloquent model'leri, policy'leri, job'ları ve notification'ları test etme
  • Proje zaten PHPUnit'te standartlaşmamışsa yeni testler için Pest'i tercih edin

Nasıl Çalışır

Red-Green-Refactor Döngüsü

  1. Başarısız bir test yazın
  2. Geçmek için minimal değişiklik uygulayın
  3. Testleri yeşil tutarken refactor edin

Test Katmanları

  • Unit: saf PHP sınıfları, value object'leri, servisler
  • Feature: HTTP endpoint'leri, auth, validation, policy'ler
  • Integration: database + kuyruk + harici sınırlar

Kapsama göre katmanları seçin:

  • Saf iş mantığı ve servisler için Unit testleri kullanın.
  • HTTP, auth, validation ve yanıt şekli için Feature testleri kullanın.
  • DB/kuyruklar/harici servisleri birlikte doğrularken Integration testleri kullanın.

Database Stratejisi

  • Çoğu feature/integration testi için RefreshDatabase (test run'ı başına bir kez migration'ları çalıştırır, ardından desteklendiğinde her testi bir transaction'a sarar; in-memory veritabanları test başına yeniden migrate edebilir)
  • Şema zaten migrate edilmişse ve sadece test başına rollback'e ihtiyacınız varsa DatabaseTransactions
  • Her test için tam bir migrate/fresh'e ihtiyacınız varsa ve maliyetini karşılayabiliyorsanız DatabaseMigrations

Veritabanına dokunan testler için varsayılan olarak RefreshDatabase kullanın: transaction desteği olan veritabanları için, test run'ı başına bir kez (static bir bayrak aracılığıyla) migration'ları çalıştırır ve her testi bir transaction'a sarar; :memory: SQLite veya transaction'sız bağlantılar için her testten önce migrate eder. Şema zaten migrate edilmişse ve sadece test başına rollback'lere ihtiyacınız varsa DatabaseTransactions kullanın.

Test Framework Seçimi

  • Mevcut olduğunda yeni testler için varsayılan olarak Pest kullanın.
  • Proje zaten PHPUnit'te standartlaşmışsa veya PHPUnit'e özgü araçlar gerektiriyorsa sadece PHPUnit kullanın.

Örnekler

PHPUnit Örneği

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']);
    }
}

Feature Test Örneği (HTTP Katmanı)

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']);
    }
}

Pest Örneği

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']);
});

Feature Test Pest Örneği (HTTP Katmanı)

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']);
});

Factory'ler ve State'ler

  • Test verileri için factory'leri kullanın
  • Uç durumlar için state'leri tanımlayın (archived, admin, trial)
$user = User::factory()->state(['role' => 'admin'])->create();

Database Testi

  • Temiz durum için RefreshDatabase kullanın
  • Testleri izole ve deterministik tutun
  • Manuel sorgular yerine assertDatabaseHas tercih edin

Persistence Test Örneği

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);
    }
}

Yan Etkiler için Fake'ler

  • Job'lar için Bus::fake()
  • Kuyruğa alınmış işler için Queue::fake()
  • Bildirimler için Mail::fake() ve Notification::fake()
  • Domain event'leri için 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);

Auth Testi (Sanctum)

use Laravel\Sanctum\Sanctum;

Sanctum::actingAs($user);

$response = $this->getJson('/api/projects');
$response->assertOk();

HTTP ve Harici Servisler

  • Harici API'leri izole etmek için Http::fake() kullanın
  • Giden payload'ları Http::assertSent() ile doğrulayın

Kapsam Hedefleri

  • Unit + feature testleri için 80%+ kapsam zorlayın
  • CI'da pcov veya XDEBUG_MODE=coverage kullanın

Test Komutları

  • php artisan test
  • vendor/bin/phpunit
  • vendor/bin/pest

Test Yapılandırması

  • Hızlı testler için phpunit.xml'de DB_CONNECTION=sqlite ve DB_DATABASE=:memory: ayarlayın
  • Dev/prod verilerine dokunmaktan kaçınmak için testler için ayrı env tutun

Yetkilendirme Testleri

use Illuminate\Support\Facades\Gate;

$this->assertTrue(Gate::forUser($user)->allows('update', $project));
$this->assertFalse(Gate::forUser($otherUser)->allows('update', $project));

Inertia Feature Testleri

Inertia.js kullanırken, Inertia test yardımcıları ile component ismi ve prop'ları doğrulayın.

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')
        );
    }
}

Testleri Inertia yanıtlarıyla uyumlu tutmak için ham JSON assertion'ları yerine assertInertia tercih edin.

Source repo
affaan-m/ECC
Skill path
docs/tr/skills/laravel-tdd/SKILL.md
Commit SHA
4e973d3eaf92
Repository license
MIT
Data collected