Codeigniter 2.1.0 & PHPUnit

Posted: February 25, 2016 in Codeigniter, PhpUnit, Unit Testing
Tags: ,

Hi, in order to use PhpUnit with Codeigniter 2.1.0, i’m using Kenjis solution at http://d.hatena.ne.jp/Kenji_s/20120117/1326763908

1 . Install PHPUnit with wget in Ubuntu (use version 4.8  wget https://phar.phpunit.de/phpunit-old.phar)

2. Then follow Kenjis instruction to download & setup my-ciunit

3. After finish step 2, edit file application/third_party/CIUnit/bootstrap_phpunit.php
Disable line 259: //require_once (‘PHPUnit/Autoload.php’);

Then you should be able to run the test by following Kenjis examples or

$ cd myProjectDir/tests

//to test all
$ phpunit

//to test specific folder, eg: models
$ phpunit models

//to test specific model
$ phpunit models/myModel.php

Bye.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s