Welcome Guest, Not a member yet? Register   Sign In
Unit Testing with TOAST - basic implementation
#9

[eluser]Bogsz[/eluser]
What if in your controller you called two models which returns data from database. And that data you got from model is being processed in the controller (i.e merge the data, add some values)

My point is, i want to test the final result of the controller and not the model

Like this example :
Code:
class Home extends CI_Controller {
    
    function __construct()
    {
        parent::__construct();    
        $this->load->model('users_model');        
    }
    
    function index()
    {
        $users = $this->users_model->get_all_users();
                if ($users->num_rows() == 0) {
                         return false;
                }
        $users_2 = $this->users_model->some_users();
                if ($users_2->num_rows() == 0) {
                         return false;
                }
        $data = array_merge($users, $users_2);

        $this->load->view('home_view',$data);
    }
}

I want to test the content of $data..
How would I do it?


Messages In This Thread
Unit Testing with TOAST - basic implementation - by El Forum - 04-18-2011, 09:04 PM
Unit Testing with TOAST - basic implementation - by El Forum - 04-18-2011, 11:05 PM
Unit Testing with TOAST - basic implementation - by El Forum - 04-19-2011, 08:44 AM
Unit Testing with TOAST - basic implementation - by El Forum - 04-19-2011, 11:01 AM
Unit Testing with TOAST - basic implementation - by El Forum - 04-19-2011, 11:15 AM
Unit Testing with TOAST - basic implementation - by El Forum - 04-19-2011, 12:13 PM
Unit Testing with TOAST - basic implementation - by El Forum - 04-19-2011, 12:22 PM
Unit Testing with TOAST - basic implementation - by El Forum - 04-19-2011, 12:26 PM
Unit Testing with TOAST - basic implementation - by El Forum - 02-02-2012, 11:04 PM
Unit Testing with TOAST - basic implementation - by El Forum - 02-14-2012, 12:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB