Skip to content

Commit 10828f6

Browse files
committed
docs: fix README inaccuracies
- Remove non-existent Printer.testFailed() — testFinished() handles both - Add missing await on PHPUnitXML.loadFile() - Replace non-existent builder.getRuntime()/getArguments() with toString()
1 parent 6b3b7d1 commit 10828f6

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

packages/phpunit/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ await initTreeSitter();
107107

108108
// 2. Load configuration
109109
const phpUnitXML = new PHPUnitXML();
110-
phpUnitXML.loadFile('/path/to/phpunit.xml');
110+
await phpUnitXML.loadFile('/path/to/phpunit.xml');
111111

112112
// 3. Create parser with AST chain (tree-sitter → php-parser fallback)
113113
const astParser = new ChainAstParser([
@@ -181,7 +181,7 @@ runner.on(TeamcityEvent.testResultSummary, (result) => {
181181

182182
// Runner lifecycle events
183183
runner.on(TestRunnerEvent.run, (builder) => {
184-
console.log('Command:', builder.getRuntime(), builder.getArguments());
184+
console.log('Command:', builder.toString());
185185
});
186186
runner.on(TestRunnerEvent.close, (code) => {
187187
console.log('Exit code:', code);
@@ -311,8 +311,7 @@ const writer = new ConsoleWriter();
311311
printer.start(command); // → "php vendor/bin/phpunit ..."
312312
printer.testVersion(result); // → "🚀 PHPUnit 11.5.0"
313313
printer.testSuiteStarted(result); // → "PASS App\Tests\ExampleTest"
314-
printer.testFinished(result); // → " ✓ test_add 3 ms"
315-
printer.testFailed(result); // → " ⨯ test_sub 5 ms"
314+
printer.testFinished(result); // → " ✓ test_add 3 ms" (or " ⨯ test_sub 5 ms" for failures)
316315
printer.testResultSummary(result); // → "Tests: 1 failed, 3 passed (12 assertions)"
317316
printer.timeAndMemory(result); // → "Duration: 0.05s"
318317
printer.close(); // flush deferred error details

packages/phpunit/README.zh-TW.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ await initTreeSitter();
106106

107107
// 2. 載入設定
108108
const phpUnitXML = new PHPUnitXML();
109-
phpUnitXML.loadFile('/path/to/phpunit.xml');
109+
await phpUnitXML.loadFile('/path/to/phpunit.xml');
110110

111111
// 3. 建立解析器,使用 AST 鏈(tree-sitter → php-parser 備援)
112112
const astParser = new ChainAstParser([
@@ -180,7 +180,7 @@ runner.on(TeamcityEvent.testResultSummary, (result) => {
180180

181181
// Runner 生命週期事件
182182
runner.on(TestRunnerEvent.run, (builder) => {
183-
console.log('命令:', builder.getRuntime(), builder.getArguments());
183+
console.log('命令:', builder.toString());
184184
});
185185
runner.on(TestRunnerEvent.close, (code) => {
186186
console.log('結束代碼:', code);
@@ -310,8 +310,7 @@ const writer = new ConsoleWriter();
310310
printer.start(command); // → "php vendor/bin/phpunit ..."
311311
printer.testVersion(result); // → "🚀 PHPUnit 11.5.0"
312312
printer.testSuiteStarted(result); // → "PASS App\Tests\ExampleTest"
313-
printer.testFinished(result); // → " ✓ test_add 3 ms"
314-
printer.testFailed(result); // → " ⨯ test_sub 5 ms"
313+
printer.testFinished(result); // → " ✓ test_add 3 ms"(失敗時為 " ⨯ test_sub 5 ms")
315314
printer.testResultSummary(result); // → "Tests: 1 failed, 3 passed (12 assertions)"
316315
printer.timeAndMemory(result); // → "Duration: 0.05s"
317316
printer.close(); // 清空延遲的錯誤詳情

0 commit comments

Comments
 (0)