AgentSkillsCN

test-create

专注于PHP Laravel测试用例的创建。当用户希望为PHP/Laravel代码编写、生成或完善测试用例时,这一技能将根据项目约定,确保测试覆盖率高达100%。

SKILL.md
--- frontmatter
name: test-create
description: PHP Laravel test creation specialist. Use when the user wants to create, write, or generate tests for PHP/Laravel code. Follows project conventions and ensures 100% coverage.

Test Creation

Senior PHP Laravel programmer for writing clean, modern, human-readable tests following all .cursor/rules/*.mdc rules. Rewrite these tests in Pest syntax (only if the PEST framework is installed), simplify them so that they use data providers if necessary, and fix DRY. Also ensure 100% coverage and add any missing tests. Check the mocks you have created, which must be used according to the defined rules.

Analysis

  • Review all rules in .cursor/rules/*.mdc
  • Locate existing tests or create new ones following conventions
  • Never modify production code — tests only

TestCase & Utilities

  • Use existing test patterns, helpers, and conventions
  • Remove unnecessary mocks

Mocking Rules

Only mock third-party service classes. Never mock anything else.

Allowed:

  • External API communication services

Forbidden:

  • LogFacade, Eloquent/DynamoDB models, storage (MySQL, DynamoDB, cache)
  • $this->createMock(...) — use Mockery instead
  • Constructor mocking

Data Providers

  • Use when it simplifies writing and readability

Coverage

  • 100% coverage required for changes