Welcome Guest, Not a member yet? Register   Sign In
Poll: Do you write test code for your CodeIgniter application?
You do not have permission to vote in this poll.
Yes
52.17%
12 52.17%
No
47.83%
11 47.83%
Total 23 vote(s) 100%
* You voted for this item. [Show Results]

CodeIgniter Testing Guide - A New Book for Automated Testing
#34

(This post was last modified: 10-28-2015, 06:41 PM by kenjis.)

Don't worry. This book is for you. ;-)

Quote:If one or more of the lines below sounds familiar, this book is perfect for you!
  • I have never written test code.
  • I want to write test code, but I don't know how.
  • I tried to write test code in the past, but I couldn't quite figure it out.

First of all, Active Record is a design pattern and the CodeIgniter 2.x's Active Record is not Active Record.
It is a Query Builder. So the Active Record was renamed to Query Builder in CodeIgniter 3.0.

Second, you don't have to worry about Active Record or not. And you don't have to stick to unit testing.
If unit testing is difficult, you could test with the database.

In the context of CodeIgniter 3.0, we can write unit tests for models. In other words, we can test models
without the database, using mock objects.

How to unit test models is explained in Chapter 6, which was released yesterday.

The answer to your question is like this:
  • It may be difficult to unit test Active Record entities, but is not impossible.
  • But I don't know unit testing them is useful or not. It depends on the code under test
Reply


Messages In This Thread
RE: CodeIgniter Testing Guide - A new book coming soon - by kenjis - 10-28-2015, 06:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB