mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-20 20:03:18 +02:00
Structure:
- Split development/ (20 files) into development/ (framework reference) and guides/ (how-to)
- Moved 13 how-to files into new guides/ category (auth, cli, error-handling, etc.)
- Moved navbar-rendering.md from system/ into development/
- Deleted empty system/README.md files
- Deleted documentation_gaps.md (all gaps resolved) and redundant info/update.md
Sidebar / navbar:
- Removed all emojis from _sidebar.md (EN + RU) — fixes tree hierarchy rendering
- Removed flag emojis from _navbar.md language switcher
- Removed duplicate entries from the old "System Documentation" section
- Renamed section headers: "Development" -> "Framework Reference" + "Developer Guides"
Content fixes (modules.md EN + RU):
- Updated "Class naming" section: now documents XcVm\Module\{Pascal} namespaces
(was "global PHP namespace — Until PHP namespaces are introduced")
- Updated main module class example to use namespace declaration + use statements
- Updated class naming in ModuleLoader description to FQN
- Replaced installCrontab() manual crontab instruction with getCronEntries() API
- Updated enable/disable section: added ModuleState enum table, updated config examples
- Fixed FAQ answer for disabling a module
Content fixes (bootstrap-contexts.md EN + RU):
- Replaced CONTEXT_* string constants with BootContext enum cases throughout
- Updated boot() signature: string $context -> BootContext $context
- Updated getContext() return type: ?string -> ?BootContext
New framework reference docs (EN + RU):
- docs/{en,ru}/development/event-system.md: EventDispatcher singleton bridge,
#[ListensTo] attribute, getEventSubscribers() array API, stoppable events,
built-in event catalog, custom event authoring, ListensTo attribute reference
- docs/{en,ru}/development/exception-hierarchy.md: full XcVmException tree,
container vs module subtrees, PSR-11 compliance notes, catch-by-subsystem examples
75 lines
1.6 KiB
Markdown
75 lines
1.6 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
/home/xc_vm/bin/php/bin/php -v
|
|
```
|
|
|
|
## 2. Download PHPUnit PHAR
|
|
|
|
This project is pinned to PHP 8.1, so use PHPUnit 10.
|
|
|
|
```bash
|
|
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
|
|
|
|
```bash
|
|
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar --version
|
|
```
|
|
|
|
## 4. Run all tests
|
|
|
|
Project config file:
|
|
|
|
- `tests/phpunit.xml.dist`
|
|
|
|
Run:
|
|
|
|
```bash
|
|
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist
|
|
```
|
|
|
|
## 5. Run a single test file
|
|
|
|
```bash
|
|
/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:
|
|
|
|
```bash
|
|
/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:
|
|
|
|
```bash
|
|
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.
|