Releases: pretzlaw/phpunit-docgen
Releases · pretzlaw/phpunit-docgen
Comment helper and phpUnit 7 & 8
With the new comment helper you can parse the markdown / HTML in your comments.
This is very handy when you want to keep documentations in sync:
->comment()of the current test method->classComment()of the current test class
Example:
class SomeTest extends TestCase {
use \Pretzlaw\PHPUnit\DocGen\DocComment\Parser;
/**
* Nice heading here
*
* Colors you can use now:
*
* 1. #ff0000
* 2. #00ff00
* 3. #0000ff
*/
function testThing() {
foreach ($this->comment()->xpath('//ol/li') as $item) {
static::assertFoo( (string) $item );
}
}
}Now your documentation will stay in sync with the sync so no longer maintaining it twice.
You can:
- Use
->xpath(...)to fetch single sections - Use
$val = $this->comment()->execute()to receive the return val of the very first PHP code block (being executed) - Use
->docBlock()to investigate other things like tags etc.
Also this is now version 3.0 because we dropped support for phpUnit 6 and now support phpUnit 7 & 8.
The difference is not very big but still the interface changed and it feels good dropping the outdated version.