How to start TDD / BDD PHP CodeIgniter

I read about TDD / BDD for a long time, but I never could understand how to implement it in the project.

This is a simplified version of the project I am currently working on:
A website that allows people to register, send books for sale. People who need these books can search for books published for sale and send an email to the seller via the website.

This is written in CodeIgniter with me as the only developer working on it. For this scenario, please tell me exactly how I will be tested - where to start and what will be tested.

I have long wanted to do this, I understand the concept, but the real implementation eludes me, thank you very much!

+7
source share
1 answer

The unit tester that comes with the latest version of CI that I used was bad, it just checked true or not.

I found this interesting project, which, apparently, was supported at least until last year:

http://jensroland.com/projects/toast/

Maybe there is something there to help you get started, maybe in the readme files - if there isnโ€™t the original message here where this idea seems to have come from.

http://codeigniter.com/forums/viewthread/76703

You can start by checking that your models return the expected set of values. those. to say that "get the first 10 books" actually returns 10 records - this means that, however, configure the test database and configure (fill with test data) and, if possible, delete this database. This is a bit of a snap, but in an MVC situation, when you start with TDD, it may be easiest to circle your head.

TDD (i.e. the idea of โ€‹โ€‹developing a test / code in this order) makes the most sense when creating your own classes, which you can consider โ€œhelpersโ€ in a typical CI setup.

+3
source

All Articles