Skip to content

Commit b758e2e

Browse files
committed
test: add phpunit bootstrap and coverage config
Add tests/bootstrap.php with error_reporting and display_errors setup, plus platform-aware coverage driver documentation. Add bootstrap attribute to phpunit.xml pointing to the new file, and add a <coverage> section with HTML (tests/coverage/) and text (tests/coverage.txt) report output targets. Plan-by: glm-5.2 Acked-by: deepseek-v4-pro Signed-off-by: kyau <git@kyaulabs.com>
1 parent 7b034b1 commit b758e2e

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

phpunit.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
bootstrap="tests/bootstrap.php"
56
cacheDirectory=".phpunit.cache"
67
colors="true"
78
>
@@ -32,4 +33,11 @@
3233
<file>.php-cs-fixer.dist.php</file>
3334
</exclude>
3435
</source>
36+
37+
<coverage>
38+
<report>
39+
<html outputDirectory="tests/coverage"/>
40+
<text outputFile="tests/coverage.txt"/>
41+
</report>
42+
</coverage>
3543
</phpunit>

tests/bootstrap.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
# $KYAULabs: bootstrap.php kyau@nova 2026/07/04 -0700 Exp $
4+
5+
6+
declare(strict_types=1);
7+
8+
// ── Platform-aware coverage driver selection ────────────────────────
9+
// PHPUnit auto-detects PCOV > Xdebug > phpdbg.
10+
// PCOV is preferred on Linux/macOS (lower overhead).
11+
// Xdebug is used on Windows (PCOV Windows DLLs only exist up to PHP 8.3;
12+
// this project targets PHP 8.5+, so Xdebug is required on Windows).
13+
//
14+
// No manual configuration needed — PHPUnit 11+ handles this.
15+
// Just ensure EITHER extension is loaded:
16+
// Linux/macOS: sudo pecl install pcov
17+
// Windows: install matching php_xdebug.dll from xdebug.org/download
18+
19+
error_reporting(E_ALL);
20+
ini_set('display_errors', '0');
21+
22+
//require_once __DIR__ . '/../aurora.inc.php';
23+
// vim: ft=php sts=4 sw=4 ts=4 et :
24+
25+
// vim: ft=php sts=4 sw=4 ts=4 et :

0 commit comments

Comments
 (0)