• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unit testing with codeigniter 2.2

#1
Hello all,

I am taking over an existing application in codeigniter 2.2 and I have to perform unit testing. What are the possible frameworks available to integrate codeigniter 2.2 with phpunit? Also, is there a unit_test class for codeigniter 2.2? I have been trying to find a solution for the past three days and no luck yet.
Reply

#2
Take a look at this: https://github.com/kenjis/ci-phpunit-test

It's currently for 3.x, but with some tweaking it should work with 2.x as well.
Reply

#3
enlivenapp the best way is to update the ci version and use ci-phpunit-test.
Reply

#4
(01-21-2017, 01:53 AM)Paradinight Wrote: enlivenapp the best way is to update the ci version and use ci-phpunit-test.

I answered his question.

Yeah, he should upgrade to latest CI for lots of reasons and I'm willing to bet he already knows he's not using the latest, so I assumed he has a reason not to upgrade. Whatever the reason(s) is, it wasn't part of the question.
Reply

#5
Not to upgrade is the wrong way and you answer is wrong. The last update was on 31 Oct 2015. Security is very important... . A old version is not secure.
Reply

#6
It's not my moral obligation to berate every person here asking questions about updating to the latest version of whatever.

If you have/had a better answer for his actual question, answer the OP and get back on topic.
Reply

#7
CI has a upgrading guide https://www.codeigniter.com/user_guide/i...ading.html

For me it was an easy task. If you have any problems or errors ask in the forum.
Reply

#8
(01-20-2017, 08:20 PM)enlivenapp Wrote: Take a look at this:  https://github.com/kenjis/ci-phpunit-test

It's currently for 3.x, but with some tweaking it should work with 2.x as well.

Unfortunately, I think tweaking it with 2.x is not so easy.
Because it is very tightly coupled with CI3. It replaces CI files including core files internally.
It was written for CI3 from scratch.

CI2 and 3 are similar to users, but 3 has a lot of lot of improvements (a little changes).
So if you use ci-phpunit-test with CI2, you need to take care of all the changes.

I recommend you upgrade CI to version 3, if you could. But if not, the following project
might help you:

https://github.com/fmalk/codeigniter-phpunit/tree/2.x
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.