Skip to content

Commit f0f125c

Browse files
committed
README instructions
1 parent 70b8de2 commit f0f125c

1 file changed

Lines changed: 46 additions & 20 deletions

File tree

README.md

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
# A PHPUnit results printer that works with the TOON format
1+
# PHPUnit TOON Result Printer
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/peterfox/phpunit-toon-result-printer.svg?style=flat-square)](https://packagist.org/packages/peterfox/phpunit-toon-result-printer)
44
[![Tests](https://img.shields.io/github/actions/workflow/status/peterfox/phpunit-toon-result-printer/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/peterfox/phpunit-toon-result-printer/actions/workflows/run-tests.yml)
55
[![Total Downloads](https://img.shields.io/packagist/dt/peterfox/phpunit-toon-result-printer.svg?style=flat-square)](https://packagist.org/packages/peterfox/phpunit-toon-result-printer)
66

7-
This is where your description should go. Try and limit it to a paragraph or two. Consider adding a small example.
7+
A PHPUnit results printer that outputs test results in [TOON](https://github.com/helgesverre/toon) (Token-Oriented Object Notation) format.
88

9-
## Support us
9+
This extension is specifically designed to provide compact, highly readable test results optimized for LLM (Large Language Model) consumption, helping AI agents quickly diagnose test failures.
1010

11-
[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/phpunit-toon-result-printer.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/phpunit-toon-result-printer)
11+
## Features
1212

13-
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
14-
15-
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
13+
- **Compact Output**: Uses TOON format to minimize token usage while remaining human-readable.
14+
- **AI-Friendly Diagnostics**: Includes file paths, line numbers, error messages, and stack traces for failed and errored tests.
15+
- **Concise Success Reports**: Passed tests only show the test name and status to keep the output focused on what needs attention.
16+
- **PHPUnit Extension**: Integrates seamlessly as a PHPUnit extension.
1617

1718
## Installation
1819

@@ -22,35 +23,60 @@ You can install the package via composer:
2223
composer require peterfox/phpunit-toon-result-printer
2324
```
2425

25-
## Usage
26+
## Configuration
27+
28+
### Permanent (Recommended)
29+
30+
To use this printer, add it as an extension in your `phpunit.xml` or `phpunit.xml.dist` file:
2631

27-
```php
28-
$skeleton = new PeterFox\PhpUnitToonResultPrinter();
29-
echo $skeleton->echoPhrase('Hello, PeterFox!');
32+
```xml
33+
<extensions>
34+
<bootstrap class="PeterFox\PhpUnitToonResultPrinter\ToonResultPrinterExtension" />
35+
</extensions>
3036
```
3137

32-
## Testing
38+
When enabled, it will suppress PHPUnit's default progress and result output, replacing it with TOON-formatted output at the end of the test execution.
39+
40+
### Manual (CLI)
41+
42+
If you don't want to enable it for all test runs, you can trigger it manually using the `--extension` flag:
3343

3444
```bash
35-
composer test
45+
vendor/bin/phpunit --extension "PeterFox\PhpUnitToonResultPrinter\ToonResultPrinterExtension"
3646
```
3747

38-
## Changelog
48+
## Example Output
3949

40-
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
50+
For a passing test:
51+
```text
52+
test: "Tests\\ExampleTest::test_it_passes"
53+
status: passed
54+
```
4155

42-
## Contributing
56+
For a failing test:
57+
```text
58+
test: "Tests\\ExampleTest::test_it_fails"
59+
status: failed
60+
file: "tests/ExampleTest.php"
61+
line: 16
62+
message: "Failed asserting that false is true."
63+
description: "Failed asserting that false is true."
64+
stackTrace: "..."
65+
```
4366

44-
Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.
67+
## Testing
4568

46-
## Security Vulnerabilities
69+
```bash
70+
composer test
71+
```
72+
73+
## Changelog
4774

48-
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
75+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
4976

5077
## Credits
5178

5279
- [Peter Fox](https://github.com/peterfox)
53-
- [All Contributors](../../contributors)
5480

5581
## License
5682

0 commit comments

Comments
 (0)