Getting PHPUnit 0.6.2 test case to work (PHP/4.3.7, Apache/2.0.49)

From: Date: Sun, 11 Jul 2004 18:12:50 +0000
Subject: Getting PHPUnit 0.6.2 test case to work (PHP/4.3.7, Apache/2.0.49)
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13647@lists.php.net to get a copy of this message
Hi there. I've been trying to setup a PHPUnit test case, but have been getting nothing but errors (well, Warnings technically). Here's the code I've used: ----- <?php require_once 'PHPUnit.php'; class DummyTest extends PHPUnit_TestCase { function DummyTest($name) {
       $this->PHPUnit_TestCase($name);
} function testFailure() {
       $this->assertEquals(true,false);
} } $suite = new PHPUnit_TestCase("DummyTest"); $result = PHPUnit::run($suite); echo $result->toHTML(); $suite = new DummyTest("DummyTest"); $result = PHPUnit::run($suite); echo $result->toHTML(); ?> ----- I added the second test suite because it seemed a bit odd that I would instantiate the base class and not the derived class, so I put it in just to be sure. And here's the output I get: ----- Warning: call_user_func(phpunit_testcase::DummyTest): First argument is expected to be a valid callback in X:\...\PEAR\PHPUnit\TestCase.php on line 154 TestCase phpunit_testcase->DummyTest() passed Warning: Missing argument 1 for dummytest() in X:\...\dummy.test.php on line 7 TestCase dummytest->DummyTest() passed ----- The warnings I might be able to live with, but assertEquals(true,false) sure as hell shouldn't pass. Now, I cannot for the LIFE of me work out why that's happening. I'm running PHP 4.3.7 under Apache 2.0.49 with mod_php on a Win2k SP4 box with PHPUnit 0.6.2. I've also tested PHPUnit 1.0.1, but then I eventually found a reference to the fact that PHPUnit 1.0+ only works on PHP5. It seemed to run fine (and generated the same warning for the first test suite; didn't test on the second), but I wanted to make sure that wasn't my problem. Any help would be greatly appreciated. My apologies if I've left any information out. -- Daniel Keep P.S. This is my first mailing list post, so please be gentle (a n00b? Aaaah!! Get it away from me!!!)

« previous php.pear.general (#13647) next »