PHPT is the kind framework that encourages testing simply by making everything so easy. All that’s needed is a file with your PHP code and expected output. It wont replace SimpleTest or PhpUnit for anything complicated (say, like PHP itself…) but it seems to be just what I’m after.

There’s little documentation about (PHP QA website was the best resource I found), but thanks to its simplicity all you need to get started is an example or two.

Sample phpt file

--TEST--
AusPostCheck class
--FILE--
<?php

    require_once("../../../test/newGuiTest/bootstrap.php");
    require_once("../check_contact_details.php");

    var_dump(AusPostCheck::SuburbStatePostcodeMatch('Windsor', 'VIC', '3181'));
    var_dump(AusPostCheck::SuburbStatePostcodeMatch('Windsor', 'VIC', '3182'));
    var_dump(AusPostCheck::SuburbStatePostcodeMatch('Windsor', 'NSW', '3181'));
    var_dump(AusPostCheck::SuburbStatePostcodeMatch('Prahran', 'VIC', '3181'));
    var_dump(AusPostCheck::SuburbStatePostcodeMatch('Foobar', 'VIC', '3181'));

?>
--EXPECT--
string(5) "MATCH"
string(8) "NO_MATCH"
string(8) "NO_MATCH"
string(5) "MATCH"
string(9) "NO_SUBURB"

Sample output

margaret ~/tests $ phpt
PHPT Test Runner v0.1.1alpha

.

Test Cases Run: 1, Passes: 1, Failures: 0, Skipped: 0