mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-11 20:02:46 +02:00
- add PHPUnit bootstrap and config under tests/ - add focused unit tests for GitHubReleases, InputValidator and FfmpegPaths - fix GitHubReleases cache file handling when switching update channel - document PHPUnit PHAR usage and debug run commands in RU/EN docs - document SFTP sync for tests/ and contributor test workflow - remove broad smoke coverage approach in favor of per-file tests
1.6 KiB
1.6 KiB
PHPUnit PHAR: Download and Run Tests
This guide shows how to run project tests with a fixed PHP binary:
- PHP binary:
/home/xc_vm/bin/php/bin/php - PHPUnit binary: local
tools/.bin/phpunit.phar
Why this setup
phpunit.phar does not include PHP. It always runs through a PHP interpreter.
If you run ./phpunit.phar directly, it may use another php from PATH.
Use the explicit binary path to keep runtime consistent.
1. Check PHP
/home/xc_vm/bin/php/bin/php -v
2. Download PHPUnit PHAR
This project is pinned to PHP 8.1, so use PHPUnit 10.
cd /home/xc_vm
mkdir -p tools/.bin
wget -O tools/.bin/phpunit.phar https://phar.phpunit.de/phpunit-10.phar
chmod +x tools/.bin/phpunit.phar
3. Verify PHPUnit
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar --version
4. Run all tests
Project config file:
tests/phpunit.xml.dist
Run:
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist
5. Run a single test file
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist tests/Unit/GitHubReleasesTest.php
6. Show which test is running now
Use debug mode to print the currently executing test:
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist --debug --no-progress
7. Optional: Coverage output
If xdebug or pcov is installed:
XDEBUG_MODE=coverage /home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist --coverage-text
Security note
Do not commit phpunit.phar into the repository. Keep it local (tools/.bin) and update independently.