Published on PracticalWeb Ltd (http://www.practicalweb.co.uk)
Install runkit for unit testing
By sean
Created 07/24/2008 - 16:37

Unit testing Drupal can be pretty challenging as it's hard to isolate parts of the code.

It seems :

  • Unit Testing Plan [1]
  • Drupalcon: Simpletest and the Future of Test-Driven Development in Drupal [2]
  • http://groups.drupal.org/node/9412 [3]
  • Drupal Unit Testing [4]
  • Unit testing plan [5]
  • Mock function testing in Drupal [6]
  • Mocking Functions in Simple Test [7]

that runkit [8] 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.so

restart 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...

© copyright PracticalWeb Ltd all rights reserved

UK registered company number 06427950


Source URL: http://www.practicalweb.co.uk/blog/08/07/24/install-runkit-unit-testing

Links:
[1] http://drupal.org/node/237959?mode=2&sort=2
[2] http://www.lullabot.com/blog/drupalcon-simpletest-and-future-test-driven-development
[3] http://groups.drupal.org/node/9412
[4] http://dhubler.googlepages.com/drupalunittestingusingstandardtools
[5] http://groups.drupal.org/node/10957
[6] http://www.workhabit.org/mock-function-testing-drupal
[7] http://www.phppatterns.com/docs/develop/simpletest_mock_functions
[8] http://us.php.net/runkit