Exemple #1
0
 function test_delete()
 {
     $test_name = "Nordstrom";
     $test_id = 1;
     $test_store = new store($test_name, $test_id);
     $test_store->save();
     $test_name2 = "Bloomingdales";
     $test_id2 = 2;
     $test_store2 = new Store($test_name2, $test_id2);
     $test_store2->save();
     $test_store->delete();
     $result = Store::getAll();
     $this->assertEquals([$test_store2], $result);
 }
Exemple #2
0
 function edit($id = 0)
 {
     $store = new store($id);
     if ($_SERVER['REQUEST_METHOD'] == "GET") {
     } else {
         $store->name = $this->input->post('name');
         $store->address = $this->input->post('address');
         $store->phone = $this->input->post('phone');
         $store->map = $this->input->post('map');
         if ($store->save()) {
             redirect($this->admin . 'stores/list_all/');
         }
     }
     $dis['base_url'] = base_url();
     $dis['title'] = "Menu";
     $dis['menu_active'] = "Cửa hàng";
     $dis['view'] = "stores/edit";
     $dis['object'] = $store;
     $this->viewadmin($dis);
 }