Przejdź do głównej zawartości
PHP Ecosystem
Explore

Testing

Ta treść nie jest jeszcze dostępna w Twoim języku.

This package provides a consistent set of Composer scripts for local validation.

Tool references:

Run Rector to apply automated code refactoring. This command modifies files.

Terminal window
composer rector

Preview the refactoring without modifying files.

Terminal window
composer rector-check

Check coding standards without modifying files.

Terminal window
composer ecs-check

Apply coding standard fixes. Review the changes before keeping them.

Terminal window
composer ecs

Verify that runtime dependencies are correctly declared in composer.json.

Terminal window
composer check-dependencies

Run mutation testing with PCOV or Xdebug coverage enabled.

Terminal window
composer mutation

Run mutation testing with PHPStan static analysis enabled.

Terminal window
composer mutation-static

Thresholds, thread count and memory options live in infection.json5. CI enforces the same thresholds: MSI and covered MSI stay at 100. Use local reports for local runs; dashboard uploads require their configured credentials. A skipped mutation run or a failed initial suite is not a passing score.

CI runs actionlint, codespell, EditorConfig Checker, markdownlint-cli2, Prettier and yamllint through the shared yii2-framework/actions quality workflow. The repository’s formatting rules stay in .editorconfig.

Make actionlint and ShellCheck available on PATH to lint workflows locally.

Terminal window
composer actionlint

Run static analysis.

Terminal window
composer static

Run the full test suite.

Terminal window
composer tests

CI runs zizmor and Gitleaks through the shared security workflow. Gitleaks uses its default rules and the allowlist in .github/linters/.gitleaks.toml. The Gitleaks scan requires GITLEAKS_LICENSE in the workflow.

Make zizmor available on PATH to audit the workflows locally with the same pedantic persona.

Terminal window
composer zizmor

Zizmor needs GitHub API access for its online audits. Use the offline flag to run without API access.

Terminal window
composer zizmor -- --offline

Report hosted CI execution and its PHP/OS matrix separately from these local commands. Keep generated reports in ignored internal/.

Composer scripts support forwarding additional arguments using --.

Run PHPUnit with code coverage report generation.

Terminal window
composer tests -- --coverage-html internal/coverage

Run PHPStan with a different memory limit.

Terminal window
composer static -- --memory-limit=512M

Use a source checkout with PHP 8.3 or later and the extensions listed in composer.json (tests also use gd and pdo_sqlite). Composer installs the development tools and the supported Yii 22 dependency:

Terminal window
composer install
composer validate --strict
composer audit

Keep security blocking and auditing enabled; do not bypass advisories to obtain a successful test run. The library’s local composer.lock is ignored, while a consuming application should retain its own lockfile. A fresh resolution may differ from an old local lock; report the versions used. Yii 2.0.x is outside this line’s supported matrix.

Copy the complete config/debug.php and config/debug-vite.php snippets from the usage examples into temporary PHP files and lint each with php -l. Load each configuration in a development Yii 22 Web application, merge it with the application’s existing configuration, bootstrap it and verify module access. In a separate production process, the example must return an empty array. The Vite example additionally needs the actual provider package and an existing compatible component; inspect an emitted event rather than panel presence only.

For browser validation, make an HTML request, inspect its toolbar/History and log capture, and verify rejected access from an unlisted IP. Static example checks do not prove browser rendering or native agent activation. Check changed Markdown links and the repository’s EditorConfig/Markdown lint rules.

This Yii adapter has no package.json or local JavaScript tests. Its assets come prebuilt from php-forge/debug-core. In a Core source checkout, keep Node.js and run its locked pipeline:

Terminal window
npm ci
npm run test:js
npm run test:mutation
npm run build
npm run check:size
npm run check:contrast:strict

Core’s CI also checks formatting, linting, browser discovery and the large-data browser harness. A Vite update can change generated output: inspect and commit the regenerated Core resources/assets/dist/ files together with its dependency lock update. Keep the CI drift check enabled. Diagnose the failing job before applying another package’s compatibility patch; passing tests/mutation do not imply an unchanged build output.


Back to documentation