Hi, I'm Mike. I'm a web developer. This is my story.

Getting CIUnit To Work With Sparks

I recently got bit by the Sparks bug again. If you don't know, Sparks is like CodeIgniter's version of Ruby Gems. It's a command-line-based package manager that lets you install stuff for CodeIgniter quickly and keep it up-to-date. It's a great idea and I want to port my libraries over to this system.

So I thought I'd try to get Kenji's CIUnit working with Sparks. His wiki says to just change one line in MY_Loader.php (which is created by Sparks) and you're good to go. I found this to not be the case, so I did a little digging. Here's what you need to do to get them to play nice together.

If you haven't already, start by installing Sparks.

In application/core/MY_Loader.php change this:

    define('SPARKPATH', 'sparks/');

to this:

    define('SPARKPATH', APPPATH . '../sparks/');

Then in application/third_party/CIUnit/core/CIU_Loader.php change this:

    class CIU_Loader extends CI_Loader {

to this:

    class CIU_Loader extends MY_Loader {

Then you should be good to go. CD back to your root/tests in the terminal and hit phpunit. If you've loaded sparks, they should now work without erroring out. Huzzah!

comments powered by Disqus