laravel-tests
Skill1 starsChanged 7 months agoMITView on GitHub
Generiert Pest-Tests für Laravel. Scannt Codebase, erstellt Tests nach Priorität. Nutze bei: "Tests schreiben", "Test generieren", "Pest Tests", "Feature Tests", "Unit Tests", "teste den Controller/Model/Service", "Coverage verbessern", "ist das getestet?", "Refactoring absichern".
In this repository18 other files it gives its agents.
- architectureSkill
- audit-projectSkill
- backendSkill
- deploySkill
- docs-structureSkill
- frontendSkill
- geoSkill
- git-commitSkill
- helpSkill
- init-projectSkill
- laravel-a11ySkill
- laravel-docsSkill
- laravel-performanceSkill
- laravel-security-auditSkill
- portfolio-texteSkill
- qaSkill
- requirementsSkill
- seoSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Plan: Test-Prioritäten festlegen (KRITISCH → NÜTZLICH)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Laravel Pest Test Generator
Grundprinzipien
- Pest-Syntax (nicht PHPUnit). 2. Arrange-Act-Assert. 3. Ein Assert pro Test.
- Factories nutzen. 5. RefreshDatabase. 6. Sprechende Namen.
Workflow
- Scan: Existierende Tests, Models, Controller, Services, Routes, Jobs identifizieren
- Plan: Test-Prioritäten festlegen (KRITISCH → NÜTZLICH)
- Infrastruktur: Pest.php, Factories, Test-Helpers prüfen
- Schreiben: Tests nach Patterns unten
- Ausführen:
php artisan testodervendor/bin/pest
Test-Prioritäten
| Priorität | Was testen |
| KRITISCH | Auth, Login, Passwort, Rollen, Payment |
| HOCH | CRUD-Operationen, Business-Logik, API-Endpoints |
| MITTEL | Validierung, Edge Cases, Mail, Jobs |
| NÜTZLICH | UI-Komponenten, Filament-Pages, Helfer |
Test-Patterns
A) Route/Controller (Feature)
it('returns 200 for published items', function () {
$item = Item::factory()->published()->create();
$this->get("/items/{$item->slug}")->assertOk();
});
it('returns 404 for unpublished items', function () {
$item = Item::factory()->unpublished()->create();
$this->get("/items/{$item->slug}")->assertNotFound();
});
it('requires auth for admin routes', function () {
$this->get('/admin')->assertRedirect('/login');
});B) Service/Business Logic (Unit)
it('calculates tax correctly', function () {
$service = new TaxService();
expect($service->calculate(100, 'AT'))->toBe(120.0);
});C) Model
it('has correct fillable fields', function () {
$model = new Item();
expect($model->getFillable())->toContain('title', 'slug');
});
it('scopes to published only', function () {
Item::factory()->published()->count(2)->create();
Item::factory()->unpublished()->create();
expect(Item::published()->count())->toBe(2);
});D) Job/Queue
it('dispatches notification job', function () {
Queue::fake();
$order->markAsPaid();
Queue::assertPushed(SendInvoiceJob::class);
});
it('handles job chain correctly', function () {
Queue::fake();
ProcessPayment::withChain([SendInvoice::class])->dispatch($order);
Queue::assertPushed(ProcessPayment::class);
});E) Livewire
it('can search items', function () {
$item = Item::factory()->create(['title' => 'Unique']);
Livewire::test(ItemList::class)
->set('search', 'Unique')
->assertSee('Unique');
});F) Security
it('prevents unauthorized access', function () {
$user = User::factory()->create();
$this->actingAs($user)->get('/admin/users')->assertForbidden();
});
it('validates CSRF on forms', function () {
$this->post('/contact', ['name' => 'Test'])->assertStatus(419);
});
it('rate limits login attempts', function () {
for ($i = 0; $i < 6; $i++) {
$this->post('/login', ['email' => 'a@b.com', 'password' => 'wrong']);
}
$this->post('/login', ['email' => 'a@b.com', 'password' => 'wrong'])
->assertStatus(429);
});G) Filament Admin
it('admin can access dashboard', function () {
$admin = User::factory()->admin()->create();
$this->actingAs($admin)->get('/admin')->assertOk();
});Hinweise
- RefreshDatabase für Feature Tests, DatabaseTransactions wenn schneller nötig
- Mail::fake(), Queue::fake(), Notification::fake() für Side-Effects
- Externe APIs (Mollie, VIES) immer mocken
- Factories mit States:
->published(),->admin(),->withTeam() - Ziel: min. 80% Coverage auf Auth, Payment, Business Logic
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

