Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

testing-best-practices

/testing-best-practices

Projektuje testy w Laravel: dobór pokrycia, nazewnictwo, asercje, dane testowe, izolację zależności i testy granic HTTP.

Licencja
MIT
Ostatnia zmiana repozytorium
12.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
10
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 12.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Projektuje testy w Laravel: dobór pokrycia, nazewnictwo, asercje, dane testowe, izolację zależności i testy granic HTTP.

Oryginalny opis (EN)

Laravel test design and review. Use when selecting coverage, naming or structuring tests, choosing assertions or test data, isolating dependencies, testing HTTP or security boundaries, improving suite performance, or reviewing test value. Use framework guidance or search-docs for Pest and PHPUnit syntax.

Jak działa

  1. Consistency First
  2. What to Test
  3. How to Apply
  4. Rule Index
Sekcje z nagłówków SKILL.md, w oryginale · 51 linii, 578 słów
Podgląd SKILL.md
---
name: testing-best-practices
description: "Laravel test design and review. Use when selecting coverage, naming or structuring tests, choosing assertions or test data, isolating dependencies, testing HTTP or security boundaries, improving suite performance, or reviewing test value. Use framework guidance or search-docs for Pest and PHPUnit syntax."
license: MIT
metadata:
  author: laravel
---

# Testing Best Practices

This skill provides rules for designing Laravel tests. Each rule file explains what to do and why. Use `search-docs` for Laravel API syntax. Fetch the PHPUnit 12.5.40 documentation at `https://phpunit.de/documentation.html` for PHPUnit API syntax.
This project uses PHPUnit. Follow the corresponding guidance in each rule.

## Consistency First

Read nearby tests before you choose syntax and organization.

A pattern repeated throughout the project is a convention, and project conventions take precedence over this skill. Follow them and give new tests the same structure.

These rules govern the tests you write now. An existing test that follows a project convention is not defective merely because it conflicts with this skill. Do not delete or rewrite it. If the convention has drawbacks, explain them and let the user decide.

## What to Test

Read this section before you write a test.

- Test observable behavior and application contracts. A test must pass after an implementation change if the behavior stays the same.
- Cover every changed decision and each applicable high-value failure mode. A decision is a branch, a validation, a calculation, or an authorization.
- Exercise declarations through behavior instead of repeating their text.
- Leave framework behavior to framework tests. Testing project configuration is not testing the framework. A constrained relationship, cast, scope, or validation rule belongs to this project.
- Keep every test that can detect a distinct defect. When two tests detect the same defect, trim the higher-layer test to one case and report the duplication. Do not delete an existing test.
- Write a feature test first. Write a unit test only for logic that does not use the framework.
- Write a feature test for every behavior reachable through a request. Real-browser tests require `laravel/dusk` and a browser download, neither of which this project installs. Mention the package only if the user asks for a real-browser test.
- Use the test tools that the project installs. Add a new test dependency, plugin, or browser only after the user asks for it.

## How to Apply

1. Read the code under test. Read the tests in the same directory. Identify every decision in the code.
2. Select every applicable branch in the rule index. Read every selected rule file.
3. Report each defect in the code before you write a test. Examples are a method with no body, a policy that no action calls, and a write action with no validation. Test the actual behavior. Report the defect to the user.
4. Write the tests. Run the smallest set of tests that covers the change. The tests must pass.
5. Check every applicable item in `rules/review.md` and every selected rule file. Resolve every mismatch before completion.

## Rule Index

Most changes need more than one rule file.

| Subject | Rule File |
| --- | --- |
| Test framework features that may already do the work | [`rules/finding-features.md`](rules/finding-features.md) |
| File layout, test names, and groups | [`rules/naming.md`](rules/naming.md) |
| Arrange-act-assert and choosing the correct assertion | [`rules/assertions.md`](rules/assertions.md) |
| Endpoint coverage, authentication, authorization, tenant isolation, validation, and browser tests | [`rules/endpoint-tests.md`](rules/endpoint-tests.md) |
| Factories, test data ownership, and repeated input values | [`rules/test-data.md`](rules/test-data.md) |
| Fakes, mocks, outbound HTTP, time, randomness, and databases | [`rules/isolation.md`](rules/isolation.md) |
| Escaping, injection, cross-tenant access, and privilege checks | [`rules/security.md`](rules/security.md) |
| Environment and CI settings for a slow suite | [`rules/performance.md`](rules/performance.md) |
| Reviewing a test or suite | [`rules/review.md`](rules/review.md) |
Pliki w paczce (10)
  • SKILL.md 4 KB
  • rules/assertions.md 3 KB
  • rules/endpoint-tests.md 3 KB
  • rules/finding-features.md 2 KB
  • rules/isolation.md 4 KB
  • rules/naming.md 2 KB
  • rules/performance.md 3 KB
  • rules/review.md 3 KB
  • rules/security.md 2 KB
  • rules/test-data.md 3 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · copa-ai/personal-nutrition100MIT
coollabsio/coolify100Apache-2.0
khalidmaquilang/starter-kit100MIT
AsyrafHussin/agent-skills100MIT
alleneubank/claude-code100Apache-2.0
ajbmachon/ajbm-skills100MIT

Migawka bazy z 13.11.2026 · wersja paczki 106b6ba5c772 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100laravel-testing
    Pisze testy w Laravel 13 z Pest 4 lub PHPUnit 12: testy HTTP, fabryki modeli, asercje bazy i mockowanie fasad.
  • 95laravel-tdd
    Pisze testy Laravel w PHPUnit lub Pest, z fabrykami modeli, testami HTTP, uwierzytelnianiem Sanctum i mockami, także metodą TDD.
  • 95laravel-tdd
    Opisuje testowanie w Laravel z PHPUnit i Pest: fabryki modeli, testy HTTP, uwierzytelnianie Sanctum, mocki i pokrycie, także przy pisaniu funkcji od testu.
  • 96laravel-tdd
    Prowadzi test-driven development w Laravel z PHPUnit i Pest, obejmując fabryki, testy bazy i cele pokrycia.
  • 100laravel-testing
    Pomaga testować kontrolery, serwisy i modele oraz stosować TDD w Laravel 13 z Pest 5 i PHPUnit 13, a na PHP 8.3 z Pest 4 i PHPUnit 12.
  • 90laravel-testing
    Pomaga pisać testy Laravel w Pest i PHPUnit, dobierać atrapy, konfigurować fabryki i testy przeglądarkowe oraz odtwarzać błędy.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.