Unit testing Drupal can be pretty challenging as it's hard to isolate parts of the code.
It seems :
- Unit Testing Plan
- Drupalcon: Simpletest and the Future of Test-Driven Development in Drupal
- http://groups.drupal.org/node/9412
- Drupal Unit Testing
- Unit testing plan
- Mock function testing in Drupal
- Mocking Functions in Simple Test
that runkit together with Drupal's implementation of SimpleTest is the way to go..
I found it a bit tricky to install on Linux (Ubuntu)
Some windows installers seem to have it built in but for those of us who like our dev and live environments to be similar:
Download runkit from cvs (I found the beta version to have bugs)
sudo aptitude install php-pear
sudo aptitude install php5-dev
mkdir temp
cd temp
cvs -d:pserver:cvsread@cvs.php.net:/repository co pecl/runkit
cvs -d:pserver:cvsread@cvs.php.net:/repository co pecl/runkit
cd pecl/runkit
phpize
./configure
make
sudo cp /home/sean/temp/pecl/runkit/modules/runkit.so /usr/lib/php5/20060613+lfs/edit /et/php5/apache2/php.ini
add the line
extension=runkit.sorestart apache
phpinfo() should now show
runkit
| runkit support | enabled |
|---|---|
| version | 1.0.0-dev |
| Custom Superglobal support | enabled |
| Sandbox Support | disable or unavailable |
| Runtime Manipulation | enabled |
Now all I've got to do is use it to build some tests...

Comments
What about the pecl command?
Can't you just install with:
pecl install runkit-0.9
Comments
Maybe 0.9 works now ...
The pecl command might work now - but at the time of writing I found that installing via pecl gave me a beta version that was buggy.
If it works for you please let me know.
Thanks
Comments
Helpful... some notes as well
From http://pecl.php.net/package/runkit:
For all those things you.... probably shouldn't have been doing anyway.... WARNING: 0.9 does not compile with PHP 5.2+ so use the CVS version instead.
So, seems CVS version is better.
Additionally, maybe it was just me, but CVS didn't seem to work. Instead I did:
svn co http://svn.php.net/repository/pecl/runkit/trunk/
Which seemed to work well.
It is slightly worrying that it has been over 2 years since 0.9 beta, but here's hoping they keep it up :)
Post new comment
Got something to add - just enter a comment
all other fields are optional.