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

Testing

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

Use PHP 8.3 or later and an npm-supported Node.js version (22.22.2+, 24.15.0+ on the 24 line, or 26+).

Terminal window
composer update --no-plugins
npm ci --ignore-scripts
npx playwright install --only-shell chromium
TIME_PICKER_DEBUG=1 composer --no-plugins tests
TIME_PICKER_DEBUG=0 composer --no-plugins tests
npm test
npm run test:dom

PHPUnit covers framework integration and Bootstrap markup. The browser suite tests display, form values, events, keyboard controls and lifecycle against both asset flavors. The jsdom suite exercises the source used to build the distributed files. Local browser checks use Chromium by default. CI runs Chromium, Firefox and WebKit.

Terminal window
npx playwright install --with-deps --only-shell chromium firefox webkit
TIME_PICKER_BROWSERS='chromium firefox webkit' npm test

This script creates a Composer archive, installs the package in an isolated application and exercises its published assets, popup placement and editing, ActiveForm, PJAX replacement and HTTP POST. Use TIME_PICKER_BROWSERS to select the engines for this script as well.

Terminal window
bash scripts/verify-consumer.sh 2.0.55
TIME_PICKER_DEPENDENCIES=lowest bash scripts/verify-consumer.sh 2.0.55
bash scripts/verify-consumer.sh 22.0.x-dev
Terminal window
npm run build
npm run check:assets
composer --no-plugins static
composer --no-plugins ecs-check
composer --no-plugins check-dependencies

The build regenerates the minified JavaScript and CSS and preserves the license banners. The check compares their bytes with the distributed files.

Install PCOV for Infection.

Terminal window
composer --no-plugins mutation
npm run coverage
npm run mutation

The build workflow produces PHP coverage and reports it to Codecov. PHPStan, ECS, Composer Require Checker and Infection are hard gates; Infection requires 100% MSI with uncovered code included. JavaScript line, function and branch coverage and Stryker require 100%; the minified assets are checked by npm run check:assets and the browser suites.

Make the CLI tools used by the shared quality workflow available on PATH: actionlint with its ShellCheck helper, codespell, EditorConfig Checker, markdownlint-cli2, Prettier and yamllint. Run all checks:

Terminal window
composer --no-plugins quality

Each tool also has its own script:

Terminal window
composer --no-plugins actionlint
composer --no-plugins codespell
composer --no-plugins editorconfig-checker
composer --no-plugins markdownlint
composer --no-plugins prettier
composer --no-plugins yamllint

The linter configuration lives in .github/linters, and the Prettier configuration in .prettierrc.json and .prettierignore. CI uses the same files.

Make zizmor and Gitleaks available on PATH. Audit the current workflow files with the same pedantic persona used by the shared security workflow:

Terminal window
composer --no-plugins zizmor

Scan Git history for secrets with the repository’s Gitleaks configuration:

Terminal window
composer --no-plugins gitleaks

Run both checks. Findings make the command fail; inspect them rather than disabling the checks.

Terminal window
composer --no-plugins security

Zizmor needs GitHub API access for its online audits. If the tool runs offline, report that limit separately. To request an offline audit explicitly:

Terminal window
composer --no-plugins zizmor -- --offline

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