Files
XC_VM/docs/ru/guides/phpunit-phar.md
T
Divarion-D f4555e7943 docs: reorganize structure, sync with current code, add missing framework reference
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
2026-06-15 18:27:23 +03:00

2.4 KiB

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

/home/xc_vm/bin/php/bin/php -v

2. Скачать PHPUnit PHAR

Проект использует PHP 8.1, поэтому используйте 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. Проверить запуск PHPUnit

/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar --version

4. Запустить все тесты

Конфиг проекта:

  • tests/phpunit.xml.dist

Запуск:

/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist

5. Запустить один тестовый файл

/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist tests/Unit/GitHubReleasesTest.php

6. Показать, какой тест выполняется сейчас

Для подробного вывода текущего выполняемого теста используйте режим отладки:

/home/xc_vm/bin/php/bin/php tools/.bin/phpunit.phar -c tests/phpunit.xml.dist --debug --no-progress

7. Опционально: вывод покрытия

Если установлен xdebug или pcov:

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) и обновляйте отдельно.