pTest framework is a testing tool for PHP 5 that uses an Object-Oriented approach to testing code.
Writing tests with pTest is straightforward and does not require any unusual naming conventions. An example of a simple test using the framework is demonstrated below:
< ?php
class SimpleTest extends BaseTest {
public function setup() {
}
public function aIsB() {
$this->false( ( 1 == 2 ), "one is not equal to two" );
$this->false( ( 'a' == 'b' ), "a is not equal to b" );
}
public function knownFacts() {
$this->true( ( 1 + 1 == 2 ), 'one and one is two' );
}
public function fatal() {
$this->true( new thisfatalerror(), 'division by zero' );
}
public function tearDown() {
}
}
? >
The console output displays the results of the test:
SimpleTest:
aIsB
false( one is not equal to two ) = passed
false( a is not equal to b ) = passed
knownFacts
true( one and one is two ) = passed
fatal
errored
Output
====================================================
Fatal error: Class 'thisfatalerror' not found in /usr/local/pTest/examples/SimpleTest.php on line 18
====================================================
4 total tests
3 passed
0 failed
0 skipped
1 errored
75.00% success.
Overall, pTest framework provides a flexible and simple approach to testing in PHP. Its ability to be easily integrated into an application and its lack of naming conventions make it a user-friendly choice for developers.
Version 1.0 Beta: N/A