Home » Testing » Testing_DocTest
A Unit Test framework for writing tests in your php code docstrings.
This package is unmaintained.
Download latest release 0.6.0 (archived versions might be outdated)
License: MIT
Description
Testing_DocTest allows the developer to write unit tests directly in the <code></code> blocs of your functions, classes and class methods doc comments.
It comes with a default runner (phpdt) that will parse all your <code></code> blocs and will run the extracted tests.
Running tests is as simple as:
$ phpdt /path/to/your/code
There are several advantages in using Testing_DocTest:
* it makes unit tests writing funnier, easier and quicker (there's no infrastructure to setup, you just install the package, write your code examples tests and you're done !);
* it ensures that doc comments are up-to-date by verifying that all examples work as documented;
* it enforces writing of tutorial documentation, liberally illustrated with input-output examples.
Maintainers
- Tobia Caneschi (tobiac) — lead, active
Dependencies
Required
- PHP (>= 5.2.2)
- PEAR Installer (>= 1.4.0)
- Console_CommandLine (>= 1.0.0RC3)
- tokenizer (extension)
Releases
- 0.6.0 (beta, 2013-01-17)
Release notes
License: MIT
* implemented tmplCode flag and template commandline for framework integration
- 0.5.0 (beta, 2010-04-10)
- 0.4.1 (beta, 2009-06-25)
Release notes
License: MIT
* fixed bug #16371: installation to wrong location
* fixed bug #16372 phpdt confused by "{$var}" notation - 0.4.0 (beta, 2009-06-08)
Release notes
License: MIT
* fixed bug #14577 Unmatched code blocks.blocks (thanks kvz),
* implemented feature request #15963: ability to include standalone doctest files (thanks to Sofia
Cardita for the patch),
* implemented feature request #15911: improved stats display,
* implemented feature request #15928: added a "-t" option to run only specified tests. - 0.3.1 (alpha, 2008-04-11)
Release notes
License: MIT
* added a Testing_DocTest_TestSuite class;
* renamed outputter to reporter;
* reporter interface improvements. - 0.3.0 (alpha, 2008-03-30)
Release notes
License: MIT
Initial PEAR release.
Changes:
* flags improvement (flags are now handled with bitwise operators);
* Testing_DocTest_TestCase class now uses __get/__set methods;
* Parser improvements in preparation for the next big refactoring.
Bugs
| ID | Status | Type | Version | Date | Summary |
|---|---|---|---|---|---|
| #14577 | Closed | Bug | 0.3.1 | 2008-08-28 | Unmatched code blocks. |
| #15911 | Closed | Req | 2009-02-18 | Change the color of the Failed Tests Summary to red | |
| #15928 | Closed | Req | 2009-02-22 | Add 'skip all tests except' option to phpdt | |
| #15948 | Wont fix | Req | 2009-02-26 | Add ability to enter into interactive mode inside a doctest | |
| #15963 | Closed | Req | 2009-03-01 | Allow the inclusion of an external doctest file | |
| #16371 | Closed | Bug | 0.4.0 | 2009-06-24 | Installation to wrong location |
| #16372 | Closed | Bug | 0.4.0 | 2009-06-24 | phpdt confused by "{$var}" notation |
| #16393 | Closed | Req | 0.4.1 | 2009-07-01 | Better support for file-level code |
| #18929 | Analyzed | Req | 0.5.0 | 2011-10-25 | Shorthand Syntax |
| #19023 | Open | Req | 0.5.0 | 2011-11-14 | Multiple tests in one code block |