function test_dont_change_order_on_edit() { $category = Category::find($this->m_id); $orden_first = $category->orden; $form_data_2 = array('name' => 'TEST_name_22', 'category_id' => NULL); Category::create($form_data_2); $category3 = Category::last(); $orden_first = $category->orden; $category->update_attributes(array('name' => 'TEST_name')); $orden_last = $category->orden; $category3->delete(); $this->_assert_equals($orden_first, $orden_last); }
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); }