-
Notifications
You must be signed in to change notification settings - Fork 1
chore: Migrate testing framework from PHPUnit to Pest v4 #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
490517c
af7ba7e
448a2ca
70c03c1
27e50af
63280fe
2743269
880951d
4742d73
51c6490
dcdb681
961e7f6
8633f42
974b047
964dc02
7e07008
0ca665c
5e09cf3
6bfc508
2d3ee25
22425f2
8b32c34
5073350
72cf4ae
f937199
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,245 @@ | ||
| language: "en" | ||
| --- | ||
| # yaml-language-server: $schema=https://docs.coderabbit.ai/schema/schema.v2.json | ||
|
|
||
| # CodeRabbit Configuration | ||
| # StringManipulation PHP 8.3+ Library | ||
| # Enforces strict quality standards: PHPStan MAX, SOLID principles, PER-CS2.0 | ||
|
|
||
| # Language and Tone | ||
| language: en-ZA | ||
| early_access: true | ||
| tone_instructions: "You're an expert PHP reviewer, proficient in PER Coding Style 2.0 (extending PSR-12 & PSR-1), SOLID, and FOOP. Advise on immutable data, pure functions, and functional composition while ensuring robust OOP. Provide concise, actionable feedback." | ||
| tone_instructions: >- | ||
| Expert PHP reviewer proficient in PER Coding Style 2.0, SOLID, and FOOP. | ||
| Advise on immutable data, pure functions, and functional composition. | ||
| Provide concise, actionable feedback. | ||
| # Review configuration | ||
| reviews: | ||
| request_changes_workflow: true | ||
| high_level_summary: true | ||
| poem: false | ||
| review_status: true | ||
| collapse_walkthrough: true | ||
| auto_review: | ||
| enabled: true | ||
| ignore_title_keywords: | ||
| - "WIP" | ||
| - "DO NOT MERGE" | ||
| drafts: false | ||
| base_branches: | ||
| - "develop" | ||
| - "feat/.*" | ||
| - "main" | ||
| path_instructions: | ||
| - path: "**/*.php" | ||
| instructions: | | ||
| Review PHP code for adherence to PER Coding Style 2.0 guidelines. Ensure proper namespace usage, code organisation, and separation of concerns. Verify that SOLID principles are followed and encourage FOOP techniques—such as employing immutable data, pure functions, and functional composition—to improve maintainability, testability, and performance. | ||
| # Review profile and behaviour | ||
| profile: "assertive" | ||
| request_changes_workflow: true | ||
| high_level_summary: true | ||
| high_level_summary_placeholder: "@coderabbitai summary" | ||
| poem: false | ||
| review_status: true | ||
| commit_status: true | ||
| fail_commit_status: false | ||
| collapse_walkthrough: true | ||
|
|
||
| # Walkthrough features | ||
| changed_files_summary: true | ||
| sequence_diagrams: true | ||
| estimate_code_review_effort: true | ||
| assess_linked_issues: true | ||
| related_issues: true | ||
| related_prs: true | ||
| suggested_labels: true | ||
| auto_apply_labels: false | ||
| suggested_reviewers: true | ||
| auto_assign_reviewers: false | ||
|
|
||
| # Path filters (exclude generated files, vendor, etc.) | ||
| path_filters: | ||
| - "!vendor/**" | ||
| - "!reports/**" | ||
| - "!node_modules/**" | ||
| - "!*.lock" | ||
| - "src/**" | ||
| - "tests/**" | ||
|
|
||
| # Path-specific instructions | ||
| path_instructions: | ||
| - path: "**/*.php" | ||
| instructions: | | ||
| Review PHP code for adherence to PER Coding Style 2.0 guidelines. | ||
| Ensure proper namespace usage, code organisation, and separation | ||
| of concerns. Verify that SOLID principles are followed and | ||
| encourage FOOP techniques—such as immutable data, pure functions, | ||
| and functional composition—to improve maintainability, | ||
| testability, and performance. | ||
| Specific checks: | ||
| - Strict typing: `declare(strict_types=1);` is required | ||
| - Explicit type declarations for all parameters and return types | ||
| - Final classes with static methods where appropriate | ||
| - Comprehensive docblocks with @param, @return, and @example tags | ||
| - No methods exceeding 100 lines (PHPMD rule) | ||
| - PHP 8.3+ features and patterns | ||
| - Proper error handling and null safety | ||
| - path: "tests/**/*.php" | ||
| instructions: | | ||
| Review test code for: | ||
| - TDD compliance (tests should be clear and comprehensive) | ||
| - PHPUnit best practices | ||
| - 100% coverage for critical paths, 90%+ for standard code | ||
| - Fast execution (unit tests <100ms, integration <5s) | ||
| - Independent, deterministic tests | ||
| - Descriptive test names and clear assertions | ||
| - Proper mocking and test isolation | ||
|
Comment on lines
+70
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The instructions for reviewing test files still refer to Review test code for:
- TDD compliance (tests should be clear and comprehensive)
- Pest best practices
- 100% coverage for critical paths, 90%+ for standard code
- Fast execution (unit tests <100ms, integration <5s)
- Independent, deterministic tests
- Descriptive test names and clear assertions
- Proper mocking and test isolation |
||
| # Automatic review settings | ||
| auto_review: | ||
| enabled: true | ||
| auto_incremental_review: true | ||
| ignore_title_keywords: | ||
| - "WIP" | ||
| - "DO NOT MERGE" | ||
| - "DRAFT" | ||
| drafts: false | ||
| base_branches: | ||
| - "main" | ||
| - "develop" | ||
| - "feat/.*" | ||
| - "fix/.*" | ||
| - "refactor/.*" | ||
|
|
||
| # Finishing touches | ||
| finishing_touches: | ||
| docstrings: | ||
| enabled: true | ||
| unit_tests: | ||
| enabled: true | ||
|
|
||
| # Pre-merge checks | ||
| pre_merge_checks: | ||
| docstrings: | ||
| mode: "error" | ||
| threshold: 80 | ||
|
|
||
| title: | ||
| mode: "warning" | ||
| requirements: "Follow conventional commits format: type(scope): description. Types: feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|security|deps|config|release" | ||
|
|
||
| description: | ||
| mode: "warning" | ||
|
|
||
| issue_assessment: | ||
| mode: "warning" | ||
|
|
||
| custom_checks: | ||
| - mode: "error" | ||
| name: "Strict Type Declarations" | ||
| instructions: "All PHP files in src/ must begin with `declare(strict_types=1);` after the opening PHP tag and before the namespace declaration." | ||
|
|
||
| - mode: "error" | ||
| name: "No Debugging Functions" | ||
| instructions: "Production code (src/ directory) must not contain debugging functions: var_dump(), var_export(), print_r(), dd(), or dump()." | ||
|
|
||
| - mode: "warning" | ||
| name: "Test Coverage" | ||
| instructions: "New code must have corresponding PHPUnit tests. Critical features require 100% line coverage; standard features require 90% coverage." | ||
|
Comment on lines
+130
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This custom check for test coverage still mentions instructions: "New code must have corresponding Pest tests. Critical features require 100% line coverage; standard features require 90% coverage." |
||
|
|
||
| - mode: "warning" | ||
| name: "Performance Complexity" | ||
| instructions: "Algorithms should avoid O(n²) or worse time complexity. Document Big O time complexity for non-trivial algorithms." | ||
|
|
||
| - mode: "warning" | ||
| name: "Security Best Practices" | ||
| instructions: "Validate all user input. Use parameterised statements for SQL queries. Never hardcode secrets, credentials, or API keys." | ||
|
|
||
| # Tools configuration | ||
| tools: | ||
| # GitHub Checks - MAX TIMEOUT (15 minutes) | ||
| github-checks: | ||
| enabled: true | ||
| timeout_ms: 900000 | ||
|
|
||
| # PHP Tools | ||
| phpstan: | ||
| enabled: true | ||
| level: "max" | ||
|
|
||
| phpmd: | ||
| enabled: true | ||
|
|
||
| phpcs: | ||
| enabled: true | ||
|
|
||
| # Security and quality tools | ||
| gitleaks: | ||
| enabled: true | ||
|
|
||
| actionlint: | ||
| enabled: true | ||
|
|
||
| semgrep: | ||
| enabled: true | ||
|
|
||
| # Documentation and style | ||
| languagetool: | ||
| enabled: true | ||
| level: "default" | ||
| enabled_only: false | ||
|
|
||
| # Disable non-PHP tools to reduce noise | ||
| shellcheck: | ||
| enabled: false | ||
|
|
||
| ruff: | ||
| enabled: false | ||
|
|
||
| eslint: | ||
| enabled: false | ||
|
|
||
| yamllint: | ||
| enabled: true | ||
|
|
||
| # Chat configuration | ||
| chat: | ||
| auto_reply: true | ||
| auto_reply: true | ||
| art: true | ||
|
|
||
| # Knowledge base | ||
| knowledge_base: | ||
| opt_out: false | ||
|
|
||
| web_search: | ||
| enabled: true | ||
|
|
||
| code_guidelines: | ||
| enabled: true | ||
| filePatterns: | ||
| - "**/CLAUDE.md" | ||
| - "**/.cursorrules" | ||
| - ".github/copilot-instructions.md" | ||
| - "docs/coding-standards.md" | ||
|
|
||
| learnings: | ||
| scope: "auto" | ||
|
|
||
| issues: | ||
| scope: "local" | ||
|
|
||
| pull_requests: | ||
| scope: "local" | ||
|
|
||
| # Code Generation Configuration | ||
| code_generation: | ||
| # Docstring Generation | ||
| docstrings: | ||
| language: en-ZA | ||
| path_instructions: | ||
| - path: "src/**/*.php" | ||
| instructions: | | ||
| Focus on explaining business behaviour and functionality, not obvious implementation. | ||
| Use South African English spelling (organisation, optimisation, analyse, behaviour). | ||
| Include @param and @return tags with proper types. | ||
| Add @throws for exceptions. | ||
| Add @example tags demonstrating usage. | ||
| Reference related documentation with @see tags. | ||
| Follow PER Coding Style 2.0 conventions. | ||
| # Unit Test Generation | ||
| unit_tests: | ||
| path_instructions: | ||
| - path: "src/**/*.php" | ||
| instructions: | | ||
| Generate PHPUnit tests following TDD principles: | ||
|
Comment on lines
+237
to
+238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| - Test names must describe behaviour: test_methodName_condition_expectedBehaviour | ||
| - Each test must follow the AAA pattern (Arrange-Act-Assert) | ||
| - Include unit tests for all public methods, edge cases, and error conditions | ||
| - Tests must be independent and deterministic | ||
| - Target fast execution (<100ms for unit tests) | ||
| - Use data providers with #[DataProvider] for testing multiple scenarios | ||
| - Focus on critical functionality and edge cases | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| root = true | ||
|
|
||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
| indent_style = space | ||
| indent_size = 4 | ||
| trim_trailing_whitespace = true | ||
|
|
||
| [*.{yml,yaml,json}] | ||
| indent_size = 2 | ||
|
|
||
| [*.md] | ||
| trim_trailing_whitespace = false | ||
|
|
||
| [Makefile] | ||
| indent_style = tab |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,9 +57,9 @@ jobs: | |
|
|
||
| # This step sets up Go environment for the job. | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v3 | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.22" | ||
| go-version: "1.23" | ||
|
|
||
| # This step installs osv-scanner for vulnerability scanning. | ||
| - name: Install osv-scanner | ||
|
|
@@ -93,16 +93,16 @@ jobs: | |
| if: steps.code-style.outcome == 'success' | ||
| run: composer test:phpmd | ||
|
|
||
| # This step runs tests with PHPUnit. | ||
| - name: Run tests with PHPUnit | ||
| id: phpunit | ||
| # This step runs tests with Pest. | ||
| - name: Run tests with Pest | ||
| id: pest | ||
| if: steps.phpmd.outcome == 'success' | ||
| run: composer test:phpunit | ||
| run: composer test:pest | ||
|
|
||
| # This step runs mutation testing with Infection. | ||
| # This step runs mutation testing with Pest. | ||
| - name: Run Mutation Testing | ||
| id: infection | ||
| if: steps.phpunit.outcome == 'success' | ||
| if: steps.pest.outcome == 'success' | ||
| run: composer test:infection | ||
|
|
||
| # This step runs static analysis with PHPStan. | ||
|
|
@@ -197,7 +197,7 @@ jobs: | |
| - name: Create release | ||
| id: create_release | ||
| if: github.ref == 'refs/heads/main' && steps.get-commits.outcome == 'success' | ||
| uses: actions/create-release@v1 | ||
| uses: softprops/action-gh-release@v2 | ||
|
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The language is set to 'en-ZA' (South African English) throughout the configuration, and path_instructions specifically mention using South African spelling (organisation, optimisation, analyse, behaviour). Ensure this is intentional and consistent across all documentation and code comments.