Ticket #196 (infoneeded enhancement)
Addition of testdox to phpunit task
| Reported by: | jamest@… | Owned by: | mrook |
|---|---|---|---|
| Priority: | minor | Milestone: | TBD |
| Component: | phing-tasks-phpunit | Version: | 2.3.0 |
| Keywords: | phpunit testdox | Cc: |
Description
Hi,
PHPUnit supports agile documentation in testdox format, but it isn't currently possible to call this from Phing. I've been hacking on a local copy of Phing and have managed to add a testdox formatter as a listener, which writes to a file. I haven't done any work on the build.xml side of things - I just have it turned on by default because that's all I need.
Is this something that would be beneficial, and suitable for inclusion in a future release? If it is, I can polish it up and add config support. I was thinking maybe an attribute of the phpunit task?
The change involves adding a listener that writes to the php://temp stream, before finally writing it to the output file. This method seems to be the only way because of how the TestDox code is implemented, without a "do not write option". I also had to subclass the PHPUnit Report Printer as its flush method closes the stream by default, before the phing listener has a chance to write it. Finally, I added testdox as a new type of FormatterElement.
I tried to follow Phing's coding and naming style, but that can obviously change if necessary.
I should mention that it's only tested and working with PHPUnit 2 so far. It also only currently supports the text version, not html.
I'll attach what I have so far so you can see what I'm talking about. No patches just yet as I've just hacked on the current release version.
Let me know what you think,
Cheers,
Jamie.
Attachments
Change History
comment:2 Changed 4 years ago by mrook
- Status changed from new to assigned
Hi Jamie, this looks like a nice feature to have -- however, I can't download the PHP files from your server for review, your server is trying to execute the files.
comment:3 Changed 4 years ago by jamest@…
I've changed the extensions to .phps - sorry about that!
Cheers,
Jamie.
comment:4 Changed 4 years ago by anonymous
Can you please repost the files somewhere?
Thanks a lot, Em.
comment:5 Changed 4 years ago by jamest@…
No time to sort out file permissions at the mo, but here's the files... They may have changed since I wrote them though...
http://jamietalbot.com/phing/testdox/readme.txt http://jamietalbot.com/phing/testdox/FormatterElement.phps http://jamietalbot.com/phing/testdox/PHPUnitTask.phps
Cheers,
Jamie.
comment:7 Changed 2 years ago by mrook
Jamie, sorry this has taken such a long time, but your site seems to be down, I can't download the new files.
comment:9 Changed 2 years ago by mrook
- Type changed from feedback to enhancement
- Milestone changed from 2.4.0RC1 to 2.4.0RC2
comment:11 Changed 2 years ago by mrook
- Milestone changed from 2.4.0RC3 to 3.0
Moving this to 3.0 for the time being.

Well, it seems like I can't submit attachments, thanks to Akismet :s I've uploaded the files, where you can get at them:
http://jamietalbot.com/phing/testdox/
The readme explains the small changes to FormatterElement and PHPUnitTask.
Cheers,
Jamie.