function __construct() { parent::__construct(__FILE__); // Remember this //creamos una categoria de test $this->load->model('category'); $parent_id = NULL; $cat_attributes = array('name' => 'TEST_name', 'category_id' => $parent_id); Category::create($cat_attributes); $this->m_category = Category::find_by_id(Category::last()->id); $this->load->model('product'); //buscamos cuantos productos hay de dicha categoria $this->m_category_products_count = Product::count_by_category_id($this->m_category->id); }