A simple unit test framework to support PHPUnit-like tests
Nearly drop-in replacement for PHPUnit, assuming you're only extending TestCase
and and calling assert{True,False,Equals,NotEquals,Null,NotNull}
from testX
methods., (*1)
Advantage over PHPUnit: No dependencies aside from PHP itself. Theoretically works with PHP 5.2, though this is no longer demonstrated by Travis CI because they keep breaking things., (*2)
Inherit from TOGoS_SimplerTest_TestCase
,
name your test case classes and source files following the naming rules,
and use phpsimplertest
to run your tests from the command-line., (*3)
For examples, see PHPSimplerTest's own tests and Makefile., (*4)
Using composer:, (*5)
composer require phpsimplertest=^1.2
To be found by TestFinder: - test classes must be defined in source files whose names end with "Test.php" - test class names must end with "Test", (*6)
Assuming you have used Composer to install phpsimplest
and that you have a source directory, src/test/php
, containing
source code for test case classes:, (*7)
vendor/bin/phpsimplertest --bootstrap=vendor/autoload.php --colorful-output src/test/php
--colorful-output
results in a nice green line of text being output
when all goes well.
If you are running tests as part a script,
you probably want to omit that., (*8)