Reputation: 2976
Are there any good open source php test suites? So far I found only http://www.lastcraft.com/simple_test.php but I couldn't found much reviews about this project. Can any one suggest me some good test suites for the php?
Upvotes: 2
Views: 535
Reputation: 2234
I also recommend PHPUnit. I'm using it with Netbeans and it works pretty good.
Upvotes: 0
Reputation: 382646
The PHPUnit is much more robust and popular.
Also have a look at:
List of Testing frameworks for PHP at Wikipedia
Upvotes: 2
Reputation: 4743
I would think that PhpUnit would be the defacto unit test suite for php.
Upvotes: 0
Reputation: 97805
The de-facto standards are:
This is an example of a test case with PHPUnit (from the manual):
class StackTest extends PHPUnit_Framework_TestCase
{
public function testPushAndPop()
{
$stack = array();
$this->assertEquals(0, count($stack));
array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertEquals(1, count($stack));
$this->assertEquals('foo', array_pop($stack));
$this->assertEquals(0, count($stack));
}
}
And this is a test with phpt:
--TEST-- URL stat PHP_STREAM_URL_STAT_QUIET does not leak memory --SKIPIF-- <?php if(!extension_loaded("rar")) print "skip"; ?> --FILE-- <?php $file = "rar://" . dirname(__FILE__) . '/dirlink_unix.rar' . "#non_existant_file"; var_dump(is_dir($file)); echo "Done.\n"; --EXPECTF-- bool(false) Done.
Upvotes: 5
Reputation: 12078
http://www.phpunit.de/ is a good one. Works just like junit for java does.
Upvotes: 0