This package is abandoned and no longer maintained. No replacement package was suggested.

Parses PHPT unit test files into sections as key-value pairs.

1.1 2012-02-08 17:20 UTC

This package is auto-updated.

Last update: 2022-02-01 12:20:07 UTC


Parses PHPT unit test files into sections as key-value pairs.


Say, for example, you have this PHPT unit test:

Test that my code works!

This test covers [blah, blah, blah...]

Zoe Slattery
# TestFest Munich 2009-05-19

	'hello' => 'World',
	'goodbye' => 'MrChips'

array(2) {
  string(5) "World"
  string(7) "MrChips"

You decide that you want to grab the contents of the FILE header:

use Skyzyx\Components\PHPT;

$file = file_get_contents('sample.phpt');
$phpt = new PHPT($file);
$results = $phpt->get_section('FILE');

echo $results;

This would display the following:

	'hello' => 'World',
	'goodbye' => 'MrChips'


Install source from GitHub

To install the source code:

git clone git://

And include it in your scripts:

require_once '/path/to/phpt/src/PHPT.php';

Install with Composer

If you're using Composer to manage dependencies, you can add PHP with it.

	"require": {
		"skyzyx/phpt": ">=1.1"

Using a Class Loader

If you're using a class loader (e.g., Symfony Class Loader):

$loader->registerNamespace('Skyzyx\\Components\\PHPT', 'path/to/vendor/phpt/src');


Tests are written in PHPT format. You can run them with either the PEAR Test Runner or with PHPUnit 3.6+.

cd tests/
pear run-tests .


cd tests/
phpunit .

License & Copyright

Copyright (c) 2010-2012 Ryan Parman. Licensed for use under the terms of the MIT license.