Files
XC_VM/docs/ru/guides/phpunit-phar.md
T
Divarion-D 76844fef11 docs: restructure, fix PSR-4 drift, and unify en/ru
Overhaul the Docsify documentation (English + Russian) so it matches the current
codebase and follows one consistent pattern.

Content accuracy (post-migration):
- Rewrite development/autoloader.md to PSR-4 / Composer (the old XC_Autoloader
  scanner, igbinary tmp/cache/autoload_map and registerDirectories are gone).
- PascalCase every source path (src/core -> src/Core, domain/Stream, cli/Commands,
  public/Controllers, Infrastructure/Redis, ...) across all docs.
- Replace the removed autoload.php references with vendor/autoload.php
  (build_system, bootstrap-contexts, error-handling, modules).
- ssl-generation: note that the installer now auto-generates a unique self-signed
  certificate before Nginx starts.

Common pattern (Clean & uniform):
- Strip emoji from headings; remove the in-page Navigation blocks (the Docsify
  sidebar already provides navigation).
- One H1 + intro per doc; uniform "Related files" / "Связанные файлы" section,
  added to the code-centric docs that lacked it.

Structure:
- Remove the empty stray docs/api/; move updates_checklist.md into builds/;
  link the previously-orphaned ucs-integration.md.
- Regroup the sidebars (split the oversized guides group into Developer Guides /
  Security & Access / Integrations; fold builds into Build & Release).

Augment:
- dev-workflow: Local Setup (make dev-tools) + Quality Checks (phpstan, cs, gates).
- build_system: Composer Dependencies section (committed prod-only vendor,
  committed lock, dev tools via composer install, no build-time vendor step).

en/ru parity:
- Apply the same structure, fixes and pattern to docs/ru/ (translated), including
  a new Russian ucs-integration.md. The en and ru file sets are now identical.
2026-06-26 15:56:15 +03:00

83 lines
2.7 KiB
Markdown

# PHPUnit PHAR: скачивание и запуск тестов
Эта инструкция показывает, как запускать тесты проекта через фиксированный PHP-бинарь:
- PHP-бинарь: `/home/xc_vm/bin/php/bin/php`
- PHPUnit-бинарь: локальный `tools/.bin/phpunit.phar`
## Почему так
`phpunit.phar` не содержит PHP внутри и всегда запускается через интерпретатор PHP.
Если запускать `./phpunit.phar` напрямую, может использоваться другой `php` из `PATH`.
Чтобы исключить ошибки окружения, используйте явный путь к бинарю.
## 1. Проверить PHP
```bash
/home/xc_vm/bin/php/bin/php -v
```
## 2. Скачать PHPUnit PHAR
Проект использует PHP 8.1, поэтому используйте 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. Проверить запуск PHPUnit
```bash
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar --version
```
## 4. Запустить все тесты
Конфиг проекта:
- `tests/phpunit.xml.dist`
Запуск:
```bash
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist
```
## 5. Запустить один тестовый файл
```bash
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist tests/Unit/GitHubReleasesTest.php
```
## 6. Показать, какой тест выполняется сейчас
Для подробного вывода текущего выполняемого теста используйте режим отладки:
```bash
/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist --debug --no-progress
```
## 7. Опционально: вывод покрытия
Если установлен `xdebug` или `pcov`:
```bash
XDEBUG_MODE=coverage /home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist --coverage-text
```
## Заметка по безопасности
Не храните `phpunit.phar` в git-репозитории. Оставляйте его локально (`tools/.bin`) и обновляйте отдельно.
## Связанные файлы
| Файл | Роль |
| --- | --- |
| `tools/.bin/phpunit.phar` | Запиненный бинарь PHPUnit |
| `tests/phpunit.xml.dist` | Конфигурация PHPUnit |
| `tests/bootstrap.php` | Бутстрап тестов (автозагрузчик Composer + константы) |