Best Cucumber Common Library code snippet using Product.fromArray
Welcome.php
Source:Welcome.php
1<?php2defined('BASEPATH') OR exit('No direct script access allowed');3class Welcome extends CI_Controller {4 /**5 * Index Page for this controller.6 *7 * Maps to the following URL8 * http://example.com/index.php/welcome9 * - or -10 * http://example.com/index.php/welcome/index11 * - or -12 * Since this controller is set as the default controller in13 * config/routes.php, it's displayed at http://example.com/14 *15 * So any other public methods not prefixed with an underscore will16 * map to /index.php/welcome/<method_mobile_no>17 * @see https://codeigniter.com/user_guide/general/urls.html18 */19 public function dashboard()20 {21 $this->load->view('dashboard');22 }23 public function index()24 {25 $this->load->view('index');26 }27 public function edit_product_amc()28 {29 $this->load->view('edit_product_amc');30 }31 public function edit_service_amc()32 {33 $this->load->view('edit_service_amc');34 }35 public function all_amc_records()36 {37 $this->load->view('all_amc_records');38 }39 public function data_product_amc()40 {41 $this->load->view('data_product_amc');42 }43 public function data_service_amc()44 {45 $this->load->view('data_service_amc');46 }47 public function addnewexecutive(){48 $this->load->model('User_model');49 $this->form_validation->set_rules('executive_code', 'Executive Code','required');50 $this->form_validation->set_rules('executive_name', 'Executive Name','required');51 $this->form_validation->set_rules('executive_type', 'Executive Type','required');52 $this->form_validation->set_rules('email', 'Email','required|valid_email');53 $this->form_validation->set_rules('address', 'Address','required');54 $this->form_validation->set_rules('mobile_no', 'Mobile Number','required');55 $this->form_validation->set_rules('password', 'Password','required');56 if ($this->form_validation->run()== false){57 $this->load->view('addnewexecutive');58 }59 else 60 {61 // save user to database.62 $fromarray=array();63 $fromarray['executive_code']= $this->input->post('executive_code');64 $fromarray['executive_name']= $this->input->post('executive_name');65 $fromarray['executive_type']= $this->input->post('executive_type');66 $fromarray['email']= $this->input->post('email');67 $fromarray['address']= $this->input->post('address');68 $fromarray['mobile_no']= $this->input->post('mobile_no');69 $fromarray['password']= $this->input->post('password');70 $this->User_model->addnewexecutive($fromarray);71 $this->session->set_flashdata('success','Record added successfully!');72 redirect(base_url().'index.php/welcome/addnewexecutive');73 }74 }75 public function addproduct(){76 $this->load->model('User_model');77 $this->form_validation->set_rules('product_code', 'Product Code','required');78 $this->form_validation->set_rules('product_brand', 'Product Brand','required');79 $this->form_validation->set_rules('product_name', 'Product Name','required');80 $this->form_validation->set_rules('product_unit', 'Product Unit','required');81 $this->form_validation->set_rules('product_details', 'Product Details','required');82 $this->form_validation->set_rules('product_warranty', 'Product Warranty','required');83 $this->form_validation->set_rules('product_image', 'Product Image','required');84 if ($this->form_validation->run()== false){85 $this->load->view('addproduct');86 }87 else 88 {89 // save user to database.90 $fromarray=array();91 $fromarray['product_code']= $this->input->post('product_code');92 $fromarray['product_brand']= $this->input->post('product_brand');93 $fromarray['product_name']= $this->input->post('product_name');94 $fromarray['product_unit']= $this->input->post('product_unit');95 $fromarray['product_details']= $this->input->post('product_details');96 $fromarray['product_warranty']= $this->input->post('product_warranty');97 $fromarray['product_image']= $this->input->post('product_image');98 $this->User_model->addproduct($fromarray);99 $this->session->set_flashdata('success','Record added successfully!');100 redirect(base_url().'index.php/welcome/addproduct');101 }102 }103 public function addproductgroup(){104 $this->load->model('User_model');105 $this->form_validation->set_rules('product_group_code', 'Product Group Code','required');106 $this->form_validation->set_rules('product_group_name', 'Product Group Name','required');107 108 if ($this->form_validation->run()== false){109 $this->load->view('addproductgroup');110 }111 else 112 {113 // save user to database.114 $fromarray=array();115 $fromarray['product_group_code']= $this->input->post('product_group_code');116 $fromarray['product_group_name']= $this->input->post('product_group_name');117 118 $this->User_model->addproductgroup($fromarray);119 $this->session->set_flashdata('success','Record added successfully!');120 redirect(base_url().'index.php/welcome/addproductgroup');121 }122 }123 public function addproductmodel(){124 $this->load->model('User_model');125 $this->form_validation->set_rules('product_model_code', 'Product Model Code','required');126 $this->form_validation->set_rules('product_model_name', 'Product Model Name','required');127 $this->form_validation->set_rules('select_product', 'Select Product','required');128 129 if ($this->form_validation->run()== false){130 $this->load->view('addproductmodel');131 }132 else 133 {134 // save user to database.135 $fromarray=array();136 $fromarray['product_model_code']= $this->input->post('product_model_code');137 $fromarray['product_model_name']= $this->input->post('product_model_name');138 $fromarray['select_product']= $this->input->post('select_product');139 140 $this->User_model->addproductmodel($fromarray);141 $this->session->set_flashdata('success','Record added successfully!');142 redirect(base_url().'index.php/welcome/addproductmodel');143 }144 }145 public function addproductserial(){146 $this->load->model('User_model');147 $this->form_validation->set_rules('product_serial_code', 'Product Serial Code','required');148 $this->form_validation->set_rules('product_model', 'Product Model','required');149 $this->form_validation->set_rules('product_name', 'Product ame','required');150 $this->form_validation->set_rules('product_price', 'Product Price','required');151 152 if ($this->form_validation->run()== false){153 $this->load->view('addproductserial');154 }155 else 156 {157 // save user to database.158 $fromarray=array();159 $fromarray['product_serial_code']= $this->input->post('product_serial_code');160 $fromarray['product_model']= $this->input->post('product_model');161 $fromarray['product_name']= $this->input->post('product_name');162 $fromarray['product_price']= $this->input->post('product_price');163 164 $this->User_model->addproductserial($fromarray);165 $this->session->set_flashdata('success','Record added successfully!');166 redirect(base_url().'index.php/welcome/addproductserial');167 }168 }169 function addnewcustomer()170 {171 $this->load->model('User_model');172 $this->form_validation->set_rules('mobile_no', 'Mobile Number','required');173 $this->form_validation->set_rules('customer_code', 'Customer Code','required');174 $this->form_validation->set_rules('customer_name', 'Customer Name','required');175 $this->form_validation->set_rules('company_name', 'Company Name','required');176 $this->form_validation->set_rules('customer_type', 'Customer Type','required');177 $this->form_validation->set_rules('address', 'Address','required');178 $this->form_validation->set_rules('city', 'City','required');179 $this->form_validation->set_rules('state', 'State','required');180 $this->form_validation->set_rules('zip', 'Zip/Postal Code','required');181 $this->form_validation->set_rules('alt_phone', 'Alternate Phone No','required');182 $this->form_validation->set_rules('email', 'Email','required|valid_email');183 $this->form_validation->set_rules('password', 'Password','required');184 //$this->form_validation->set_rules('note', 'Note');185 $this->form_validation->set_rules('select_file', 'File');186 if ($this->form_validation->run()== false){187 $this->load->view('addnewcustomer');188 }189 else { // save user to database.190 $fromarray=array();191 $fromarray['mobile_no']= $this->input->post('mobile_no');192 $fromarray['customer_code']= $this->input->post('customer_code');193 $fromarray['customer_name']= $this->input->post('customer_name');194 $fromarray['company_name']= $this->input->post('company_name');195 $fromarray['customer_type']= $this->input->post('customer_type');196 $fromarray['address']= $this->input->post('address');197 $fromarray['city']= $this->input->post('city');198 $fromarray['state']= $this->input->post('state');199 $fromarray['zip']= $this->input->post('zip');200 $fromarray['alt_phone']= $this->input->post('alt_phone');201 $fromarray['email']= $this->input->post('email');202 $fromarray['password']= $this->input->post('password');203 $fromarray['note']= $this->input->post('note');204 $fromarray['select_file']= $this->input->post('select_file'); 205 $this->User_model->addnewcustomer($fromarray);206 $this->session->set_flashdata('success','Record added successfully!');207 redirect(base_url().'index.php/welcome/addnewcustomer');208 } 209 }210 function edit_customer($userid)211 {212 //$this->load->view('edit_customer');213 $this->load->model('user_model');214 $user=$this->user_model->get_customer($userid);215 $data = array();216 $data['user'] = $user;217 $this->form_validation->set_rules('mobile_no', 'Mobile Number','required');218 $this->form_validation->set_rules('customer_code', 'Customer Code','required');219 $this->form_validation->set_rules('customer_name', 'Customer Name','required');220 $this->form_validation->set_rules('company_name', 'Company Name','required');221 $this->form_validation->set_rules('customer_type', 'Customer Type','required');222 $this->form_validation->set_rules('address', 'Address','required');223 $this->form_validation->set_rules('city', 'City','required');224 $this->form_validation->set_rules('state', 'State','required');225 $this->form_validation->set_rules('zip', 'Zip/Postal Code','required');226 $this->form_validation->set_rules('alt_phone', 'Alternate Phone No','required');227 $this->form_validation->set_rules('email', 'Email','required|valid_email');228 $this->form_validation->set_rules('password', 'Password','required');229 //$this->form_validation->set_rules('note', 'Note');230 $this->form_validation->set_rules('select_file', 'File');231 if($this->form_validation->run() == false)232 {233 $this->load->view('edit_customer',$data);234 }235 else236 {237 $fromarray = array();238 $fromarray['mobile_no']= $this->input->post('mobile_no');239 $fromarray['customer_code']= $this->input->post('customer_code');240 $fromarray['customer_name']= $this->input->post('customer_name');241 $fromarray['company_name']= $this->input->post('company_name');242 $fromarray['customer_type']= $this->input->post('customer_type');243 $fromarray['address']= $this->input->post('address');244 $fromarray['city']= $this->input->post('city');245 $fromarray['state']= $this->input->post('state');246 $fromarray['zip']= $this->input->post('zip');247 $fromarray['alt_phone']= $this->input->post('alt_phone');248 $fromarray['email']= $this->input->post('email');249 $fromarray['password']= $this->input->post('password');250 $fromarray['note']= $this->input->post('note');251 $fromarray['select_file']= $this->input->post('select_file'); 252 $this->user_model->update_customer($userid,$fromarray);253 $this->session->set_flashdata('success','Record updated successfully');254 redirect(base_url().'index.php/welcome/managecustomer');255 }256 }257 function delete_customer($userid)258 {259 $this->load->model('user_model');260 $user=$this->user_model->get_customer($userid);261 if(empty($user)) 262 {263 $this->session->set_flashdata('failure','record not found in database');264 redirect(base_url().'index.php/welcome/managecustomer');265 }266 else{267 $this->user_model->delete_customer($userid);268 $this->session->set_flashdata('success','record deleted successfully');269 redirect(base_url().'index.php/welcome/managecustomer');270 }271 }272 function edit_executive($userid)273 {274 $this->load->model('user_model');275 $user=$this->user_model->get_executive($userid);276 $data = array();277 $data['user'] = $user;278 $this->form_validation->set_rules('executive_code', 'Executive Code','required');279 $this->form_validation->set_rules('executive_name', 'Executive Name','required');280 $this->form_validation->set_rules('executive_type', 'Executive Type','required');281 $this->form_validation->set_rules('email', 'Email','required|valid_email');282 $this->form_validation->set_rules('address', 'Address','required');283 $this->form_validation->set_rules('mobile_no', 'Mobile Number','required');284 $this->form_validation->set_rules('password', 'Password','required');285 if($this->form_validation->run() == false)286 {287 $this->load->view('edit_executive',$data);288 }289 else290 {291 $fromarray = array();292 $fromarray['executive_code']= $this->input->post('executive_code');293 $fromarray['executive_name']= $this->input->post('executive_name');294 $fromarray['executive_type']= $this->input->post('executive_type');295 $fromarray['email']= $this->input->post('email');296 $fromarray['address']= $this->input->post('address');297 $fromarray['mobile_no']= $this->input->post('mobile_no');298 $fromarray['password']= $this->input->post('password');299 $this->user_model->update_executive($userid,$fromarray);300 $this->session->set_flashdata('success','Record updated successfully');301 redirect(base_url().'index.php/welcome/manageexecutive');302 }303 }304 function delete_executive($userid)305 {306 $this->load->model('user_model');307 $user=$this->user_model->get_executive($userid);308 if(empty($user)) 309 {310 $this->session->set_flashdata('failure','record not found in database');311 redirect(base_url().'index.php/welcome/manage_product');312 }313 else314 {315 $this->user_model->delete_executive($userid);316 $this->session->set_flashdata('success','record deleted successfully');317 redirect(base_url().'index.php/welcome/manageexecutive');318 }319 }320 function edit_product($userid)321 {322 $this->load->model('user_model');323 $user=$this->user_model->get_product($userid);324 $data = array();325 $data['user'] = $user;326 $this->form_validation->set_rules('product_code', 'Product Code','required');327 $this->form_validation->set_rules('product_brand', 'Product Brand','required');328 $this->form_validation->set_rules('product_name', 'Product Name','required');329 $this->form_validation->set_rules('product_unit', 'Product Unit','required');330 $this->form_validation->set_rules('product_details', 'Product Details','required');331 $this->form_validation->set_rules('product_warranty', 'Product Warranty','required');332 $this->form_validation->set_rules('product_image', 'Product Image','required');333 if($this->form_validation->run() == false)334 {335 $this->load->view('edit_product',$data);336 }337 else338 {339 $fromarray = array();340 $fromarray['product_code']= $this->input->post('product_code');341 $fromarray['product_brand']= $this->input->post('product_brand');342 $fromarray['product_name']= $this->input->post('product_name');343 $fromarray['product_unit']= $this->input->post('product_unit');344 $fromarray['product_details']= $this->input->post('product_details');345 $fromarray['product_warranty']= $this->input->post('product_warranty');346 $fromarray['product_image']= $this->input->post('product_image');347 $this->user_model->update_product($userid,$fromarray);348 $this->session->set_flashdata('success','Record updated successfully');349 redirect(base_url().'index.php/welcome/manage_product');350 }351 }352 function delete_product($userid)353 {354 $this->load->model('user_model');355 $user=$this->user_model->get_product($userid);356 if(empty($user)) 357 {358 $this->session->set_flashdata('failure','record not found in database');359 redirect(base_url().'index.php/welcome/manage_product');360 }361 else{362 $this->user_model->delete_product($userid);363 $this->session->set_flashdata('success','record deleted successfully');364 redirect(base_url().'index.php/welcome/manage_product');365 }366 }367 function edit_product_group($userid)368 {369 $this->load->model('user_model');370 $user=$this->user_model->get_product_group($userid);371 $data = array();372 $data['user'] = $user;373 $this->form_validation->set_rules('product_group_code', 'Product Group Code','required');374 $this->form_validation->set_rules('product_group_name', 'Product Group Name','required');375 376 if($this->form_validation->run() == false)377 {378 $this->load->view('edit_product_group',$data);379 }380 else381 {382 $fromarray = array();383 $fromarray['product_group_code']= $this->input->post('product_group_code');384 $fromarray['product_group_name']= $this->input->post('product_group_name');385 $this->user_model->update_product_group($userid,$fromarray);386 $this->session->set_flashdata('success','Record updated successfully');387 redirect(base_url().'index.php/welcome/manage_product_group');388 }389 }390 function delete_product_group($userid)391 {392 $this->load->model('user_model');393 $user=$this->user_model->get_product_group($userid);394 if(empty($user)) 395 {396 $this->session->set_flashdata('failure','record not found in database');397 redirect(base_url().'index.php/welcome/manage_product_group');398 }399 else{400 $this->user_model->delete_product_group($userid);401 $this->session->set_flashdata('success','record deleted successfully');402 redirect(base_url().'index.php/welcome/manage_product_group');403 }404 }405 function edit_product_model($userid)406 {407 $this->load->model('user_model');408 $user=$this->user_model->get_product_model($userid);409 $data = array();410 $data['user'] = $user;411 $this->form_validation->set_rules('product_model_code', 'Product Model Code','required');412 $this->form_validation->set_rules('product_model_name', 'Product Model Name','required');413 $this->form_validation->set_rules('select_product', 'Select Product','required');414 415 if($this->form_validation->run() == false)416 {417 $this->load->view('edit_product_model',$data);418 }419 else420 {421 $fromarray = array();422 $fromarray['product_model_code']= $this->input->post('product_model_code');423 $fromarray['product_model_name']= $this->input->post('product_model_name');424 $fromarray['select_product']= $this->input->post('select_product');425 $this->user_model->update_product_model($userid,$fromarray);426 $this->session->set_flashdata('success','Record updated successfully');427 redirect(base_url().'index.php/welcome/manage_product_model');428 }429 }430 function delete_product_model($userid)431 {432 $this->load->model('user_model');433 $user=$this->user_model->get_product_model($userid);434 if(empty($user)) 435 {436 $this->session->set_flashdata('failure','record not found in database');437 redirect(base_url().'index.php/welcome/manage_product_model');438 }439 else{440 $this->user_model->delete_product_model($userid);441 $this->session->set_flashdata('success','record deleted successfully');442 redirect(base_url().'index.php/welcome/manage_product_model');443 }444 }445 function edit_product_serial($userid)446 {447 $this->load->model('user_model');448 $user=$this->user_model->get_product_serial($userid);449 $data = array();450 $data['user'] = $user;451 $this->form_validation->set_rules('product_serial_code', 'Product Serial Code','required');452 $this->form_validation->set_rules('product_model', 'Product Model','required');453 $this->form_validation->set_rules('product_name', 'Product ame','required');454 $this->form_validation->set_rules('product_price', 'Product Price','required');455 456 if($this->form_validation->run() == false)457 {458 $this->load->view('edit_product_serial',$data);459 }460 else461 {462 $fromarray = array();463 $fromarray['product_serial_code']= $this->input->post('product_serial_code');464 $fromarray['product_model']= $this->input->post('product_model');465 $fromarray['product_name']= $this->input->post('product_name');466 $fromarray['product_price']= $this->input->post('product_price');467 $this->user_model->update_product_serial($userid,$fromarray);468 $this->session->set_flashdata('success','Record updated successfully');469 redirect(base_url().'index.php/welcome/manage_product_serial');470 }471 }472 function delete_product_serial($userid)473 {474 $this->load->model('user_model');475 $user=$this->user_model->get_product_serial($userid);476 if(empty($user)) 477 {478 $this->session->set_flashdata('failure','record not found in database');479 redirect(base_url().'index.php/welcome/manage_product_serial');480 }481 else{482 $this->user_model->delete_product_serial($userid);483 $this->session->set_flashdata('success','record deleted successfully');484 redirect(base_url().'index.php/welcome/manage_product_serial');485 }486 }487 public function managecustomer()488 {489 $this->load->model('User_model');490 $new_customer = $this->User_model->managecustomer();491 $data = array();492 $data['new_customer']= $new_customer;493 $this->load->view('managecustomer',$data);494 }495 public function manageexecutive()496 {497 $this->load->model('User_model');498 $new_executive = $this->User_model->manageexecutive();499 $data = array();500 $data['new_executive']= $new_executive;501 $this->load->view('manageexecutive',$data);502 }503 public function manage_product()504 {505 $this->load->model('User_model');506 $new_product = $this->User_model->manage_product();507 $data = array();508 $data['new_product']= $new_product;509 $this->load->view('manage_product',$data);510 }511 public function manage_product_group()512 {513 $this->load->model('User_model');514 $new_product_group = $this->User_model->manage_product_group();515 $data = array();516 $data['new_product_group']= $new_product_group;517 $this->load->view('manage_product_group',$data);518 }519 public function manage_product_model()520 {521 $this->load->model('User_model');522 $new_product_model = $this->User_model->manage_product_model();523 $data = array();524 $data['new_product_model']= $new_product_model;525 $this->load->view('manage_product_model',$data);526 }527 public function manage_product_serial()528 {529 $this->load->model('User_model');530 $new_product_serial = $this->User_model->manage_product_serial();531 $data = array();532 $data['new_product_serial']= $new_product_serial;533 $this->load->view('manage_product_serial',$data);534 }535 public function product_amc()536 {537 $this->load->model('User_model');538 $product_amc = $this->User_model->product_amc();539 $data = array();540 $data['product_amc']= $product_amc;541 $this->load->view('product_amc',$data);542 }543 public function service_amc()544 {545 $this->load->model('User_model');546 $service_amc = $this->User_model->service_amc();547 $data = array();548 $data['service_amc']= $service_amc;549 $this->load->view('service_amc',$data);550 }551 public function productserviceamc()552 {553 $this->load->view('productserviceamc');554 }555}...
ShippingTplsTest.php
Source:ShippingTplsTest.php
...18 $tpls->destroy();19 }20 protected function getFreeShippingTpl()21 {22 return wei()->shippingTpl()->fromArray([23 'freeShipping' => '1',24 ]);25 }26 protected function getDefaultShippingTpl()27 {28 $tpl = wei()->shippingTpl()->setAppId()->save([29 'name' => 'æµè¯',30 'logisticsIds' => [31 '1',32 '2',33 ],34 'useLogisticsIds' => [35 '1' => '0',36 '2' => '0',37 ],38 ]);39 $rules = wei()->shippingTplRule()->beColl();40 $tpl->setRules($rules);41 // é»è®¤å¿«é42 $rules[] = wei()->shippingTplRule()->fromArray([43 'shippingTplId' => $tpl['id'],44 'logisticsId' => '1',45 'isDefault' => '1',46 'startFee' => '11.00',47 'plusFee' => '3.00',48 ]);49 $rules[] = wei()->shippingTplRule()->fromArray([50 'shippingTplId' => $tpl['id'],51 'logisticsId' => '1',52 'isDefault' => '0',53 'areas' => [54 '440300',55 '440100', // æ·±å³å¸,广å·å¸56 ],57 'startFee' => '8.00',58 'plusFee' => '1.00',59 ]);60 // ç©æµæå¡261 $rules[] = wei()->shippingTplRule()->fromArray([62 'shippingTplId' => $tpl['id'],63 'logisticsId' => '2',64 'isDefault' => '1',65 'startFee' => '10.00',66 'plusFee' => '2.00',67 ]);68 $rules[] = wei()->shippingTplRule()->fromArray([69 'shippingTplId' => $tpl['id'],70 'logisticsId' => '2',71 'isDefault' => '0',72 'areas' => [73 '440100', // 广å·å¸74 ],75 'startFee' => '9.00',76 'plusFee' => '1.00',77 ]);78 $rules->save();79 return $tpl;80 }81 protected function getUseShippingTpl()82 {83 $tpl = wei()->shippingTpl()->setAppId()->save([84 'name' => 'æµè¯',85 'logisticsIds' => [86 '1',87 '2',88 '3',89 ],90 'useLogisticsIds' => [91 '1' => '0',92 '2' => '0',93 '3' => '2', // 使ç¨ç©æµ2çé
ç½®94 ],95 ]);96 $rules = wei()->shippingTplRule()->beColl();97 $tpl->setRules($rules);98 // é»è®¤å¿«é99 $rules[] = wei()->shippingTplRule()->fromArray([100 'shippingTplId' => $tpl['id'],101 'logisticsId' => '1',102 'isDefault' => '1',103 'startFee' => '10.00',104 'plusFee' => '3.00',105 ]);106 $rules[] = wei()->shippingTplRule()->fromArray([107 'shippingTplId' => $tpl['id'],108 'logisticsId' => '1',109 'isDefault' => '0',110 'areas' => [111 '440300',112 '440100', // æ·±å³å¸,广å·å¸113 ],114 'startFee' => '8.00',115 'plusFee' => '1.00',116 ]);117 // ç©æµ2118 $rules[] = wei()->shippingTplRule()->fromArray([119 'shippingTplId' => $tpl['id'],120 'logisticsId' => '2',121 'isDefault' => '1',122 'startFee' => '10.02',123 'plusFee' => '2.02',124 ]);125 $rules[] = wei()->shippingTplRule()->fromArray([126 'shippingTplId' => $tpl['id'],127 'logisticsId' => '2',128 'isDefault' => '0',129 'areas' => [130 '440100',131 '310100', // 广å·å¸,ä¸æµ·å¸å¸è¾åº132 ],133 'startFee' => '9.02',134 'plusFee' => '1.02',135 ]);136 // ç©æµ3 æé»è®¤è§å,ä½æ¯åå§åæ¶ä¼è¢«æ¸
空137 $rules[] = wei()->shippingTplRule()->fromArray([138 'shippingTplId' => $tpl['id'],139 'logisticsId' => '3',140 'isDefault' => '1',141 'startFee' => '10.03',142 'plusFee' => '2.03',143 ]);144 $rules->save();145 return $tpl;146 }147 /**148 * æµè¯æ ¹æ®è´ç©è½¦åå°å,è·åå¯ç¨çè¿è´¹è§å149 */150 public function ignoreTestFreeGetFees()151 {152 // å
é®çè¿è´¹æ¨¡æ¿153 $shippingTpl = $this->getFreeShippingTpl();154 // 产å1155 $product = wei()->product();156 $product->setOption('shippingTpl', $shippingTpl);157 $carts = wei()->cart()->multiple();158 // è´ç©è½¦1159 $cart = wei()->cart()->fromArray([160 'quantity' => 10,161 ]);162 $cart->setProduct($product);163 $carts[] = $cart;164 // 产å2165 $product2 = wei()->product();166 $product2->setOption('shippingTpl', $shippingTpl);167 // è´ç©è½¦2168 $cart2 = wei()->cart()->fromArray([169 'quantity' => 5,170 ]);171 $cart2->setProduct($product2);172 $carts[] = $cart2;173 $services = wei()->shippingTpl->getShippingServices($carts);174 $this->assertEquals(1, count($services));175 $this->assertEquals(['id' => '1', 'name' => 'å¿«é', 'fee' => '0.00'], $services[0]);176 }177 public function ignoreTestGetFees()178 {179 // é»è®¤è¿è´¹æ¨¡æ¿180 $shippingTpl = $this->getDefaultShippingTpl();181 // 产å1182 $product = wei()->product();183 $product->setOption('shippingTpl', $shippingTpl);184 $carts = wei()->cart()->multiple();185 // è´ç©è½¦1186 $cart = wei()->cart()->fromArray([187 'quantity' => 10,188 ]);189 $cart->setProduct($product);190 $carts[] = $cart;191 // 产å2192 $product2 = wei()->product();193 $product2->setOption('shippingTpl', $shippingTpl);194 // è´ç©è½¦2195 $cart2 = wei()->cart()->fromArray([196 'quantity' => 5,197 ]);198 $cart2->setProduct($product2);199 $carts[] = $cart2;200 // å°å1201 $address = wei()->address()->fromArray(['city' => 'æ·±å³å¸']);202 $services = wei()->shippingTpl->getShippingServices($carts, $address);203 $this->assertEquals(2, count($services));204 // 10é¦ + 2ç» * (10 - 1)件 + 2ç» * 5件 = 38205 $this->assertEquals(['id' => '2', 'name' => 'å°åºèªæ', 'fee' => 38], $services[0]);206 // 8é¦ + 1ç» * (10 - 1)件 + 1ç» * 5件 = 22207 $this->assertEquals(['id' => '1', 'name' => 'å¿«é', 'fee' => 22], $services[1]);208 }209 /**210 * æµè¯èæååç订åè¿è´¹211 */212 public function ignoreTestVirtualProductWithShippingTpl()213 {214 $shippingTpl = $this->getDefaultShippingTpl();215 $product = wei()->product();216 $skuId = wei()->seq();217 $attrId = wei()->seq();218 $product->create([219 'id' => wei()->seq(),220 'name' => 'æµè¯åå',221 'price' => '100',222 'quantity' => 10,223 'isVirtual' => 1,224 'images' => [225 'test.jpg',226 ],227 'skus' => [228 [229 'id' => $skuId,230 'price' => '100.00',231 'quantity' => 23,232 'attrIds' => [$attrId],233 ],234 ],235 'skuConfigs' => [236 [237 'id' => wei()->seq(),238 'name' => 'é¢è²',239 'attrs' => [240 [241 'id' => $attrId,242 'value' => 'ç½è²',243 ],244 ],245 ],246 ],247 ]);248 $product->setOption('shippingTpl', $shippingTpl);249 // è´ç©è½¦1250 $cart = wei()->cart()->fromArray([251 'quantity' => 5,252 ]);253 $cart->setProduct($product);254 $carts = wei()->cart()->multiple();255 $carts[] = $cart;256 // å°å1257 $address = wei()->address()->fromArray(['city' => 'æ·±å³å¸']);258 $services = wei()->shippingTpl->getShippingServices($carts, $address);259 $this->assertEquals(0, $services[1]['fee']);260 // æ¹æéè¦å°åç261 $product['isVirtual'] = 0;262 // è´ç©è½¦2263 $cart2 = wei()->cart()->fromArray([264 'quantity' => 5,265 ]);266 $cart2->setProduct($product);267 $carts2 = wei()->cart()->multiple();268 $carts2[] = $cart2;269 $services = wei()->shippingTpl->getShippingServices($carts2, $address);270 $this->assertEquals('12.00', $services[1]['fee']);271 }272 public function ignoreTestGetFeesWithFreeShippingTpl()273 {274 // è¿è´¹æ¨¡æ¿1275 $shippingTpl = $this->getDefaultShippingTpl();276 // 产å1277 $product = wei()->product();278 $product->setOption('shippingTpl', $shippingTpl);279 $carts = wei()->cart()->multiple();280 // è´ç©è½¦1281 $cart = wei()->cart()->fromArray([282 'quantity' => 10,283 ]);284 $cart->setProduct($product);285 $carts[] = $cart;286 // è¿è´¹æ¨¡æ¿2287 $shippingTpl2 = $this->getFreeShippingTpl();288 // 产å2289 $product2 = wei()->product();290 $product2->setOption('shippingTpl', $shippingTpl2);291 // è´ç©è½¦2292 $cart2 = wei()->cart()->fromArray([293 'quantity' => 5,294 ]);295 $cart2->setProduct($product2);296 $carts[] = $cart2;297 // å°å1298 $address = wei()->address()->fromArray(['city' => 'æ·±å³å¸']);299 $services = wei()->shippingTpl->getShippingServices($carts, $address);300 $this->assertEquals(2, count($services));301 // 10é¦ + 2ç» * (10 - 1)件 + 0ç» * 5件 = 28302 $this->assertEquals(['id' => '2', 'name' => 'å°åºèªæ', 'fee' => 28], $services[0]);303 // 8é¦ + 1ç» * (10 - 1)件 + 0ç» * 5件 = 17304 $this->assertEquals(['id' => '1', 'name' => 'å¿«é', 'fee' => 17], $services[1]);305 }306 /**307 * æ ¹æ®è´ç©è½¦åå°å,è·åå¯ç¨çè¿è´¹è§å308 */309 public function ignoreTestGetFeesWithDiffTpl()310 {311 // è´ç©è½¦coll312 $carts = wei()->cart()->multiple();313 // è¿è´¹æ¨¡æ¿1314 $shippingTpl = $this->getDefaultShippingTpl();315 // 产å1316 $product = wei()->product();317 $product->setOption('shippingTpl', $shippingTpl);318 // è´ç©è½¦1319 $cart = wei()->cart()->fromArray([320 'quantity' => 10,321 ]);322 $cart->setProduct($product);323 $carts[] = $cart;324 // è¿è´¹æ¨¡æ¿2325 $useShippingTpl = $this->getUseShippingTpl();326 // 产å2327 $product2 = wei()->product();328 $product2->setOption('shippingTpl', $useShippingTpl);329 // è´ç©è½¦2330 $cart2 = wei()->cart()->fromArray([331 'quantity' => 5,332 ]);333 $cart2->setProduct($product2);334 $carts[] = $cart2;335 // å°å1336 $address = wei()->address()->fromArray(['city' => 'æ·±å³å¸']);337 $services = wei()->shippingTpl->getShippingServices($carts, $address);338 $this->assertEquals(2, count($services));339 // 10.02é¦ + 2.02ç» * (5 - 1)件 + 2ç» * 10件340 $this->assertEquals(['id' => '2', 'name' => 'å°åºèªæ', 'fee' => 38.10], $services[0]);341 // 8é¦ + 1ç» * (10 - 1)件 + 1æ·±å³ç» * 5件 = 22342 $this->assertEquals(['id' => '1', 'name' => 'å¿«é', 'fee' => 22], $services[1]);343 }344 /**345 * æ ¹æ®è´ç©è½¦åå°å,è·åå¯ç¨çè¿è´¹è§å346 */347 public function ignoreTestGetFeesWithNewTpl()348 {349 // è´ç©è½¦coll350 $carts = wei()->cart()->multiple();351 // è¿è´¹æ¨¡æ¿1352 $shippingTpl = $this->getDefaultShippingTpl();353 // 产å1354 $product = wei()->product();355 $product->setOption('shippingTpl', $shippingTpl);356 // è´ç©è½¦1357 $cart = wei()->cart()->fromArray([358 'quantity' => 10,359 ]);360 $cart->setProduct($product);361 $carts[] = $cart;362 // è¿è´¹æ¨¡æ¿2363 $shippingTpl2 = wei()->shippingTpl();364 // 产å2365 $product2 = wei()->product();366 $product2->setOption('shippingTpl', $shippingTpl2);367 // è´ç©è½¦2368 $cart2 = wei()->cart()->fromArray([369 'quantity' => 5,370 ]);371 $cart2->setProduct($product2);372 $carts[] = $cart2;373 // å°å1374 $address = wei()->address()->fromArray(['city' => 'æ·±å³å¸']);375 $services = wei()->shippingTpl->getShippingServices($carts, $address);376 $this->assertEquals(2, count($services));377 // 10é¦ + 2ç» * (10 - 1)件 + 0ç» * 5件 = 28378 $this->assertEquals(['id' => '2', 'name' => 'å°åºèªæ', 'fee' => 28], $services[0]);379 // 8é¦ + 1ç» * (10 - 1)件 + 0ç» * 5件 = 17380 $this->assertEquals(['id' => '1', 'name' => 'å¿«é', 'fee' => 17], $services[1]);381 }382 /**383 * æ ¹æ®è´ç©è½¦åå°å,è·åå¯ç¨çè¿è´¹è§å384 */385 public function ignoreTestGetFeesWithEmptyTpl()386 {387 // è´ç©è½¦coll388 $carts = wei()->cart()->multiple();389 // è¿è´¹æ¨¡æ¿1390 $shippingTpl = $this->getDefaultShippingTpl();391 // 产å1392 $product = wei()->product();393 $product->setOption('shippingTpl', $shippingTpl);394 // è´ç©è½¦1395 $cart = wei()->cart()->fromArray([396 'quantity' => 10,397 ]);398 $cart->setProduct($product);399 $carts[] = $cart;400 // è¿è´¹æ¨¡æ¿2401 $shippingTpl2 = wei()->shippingTpl()->setAppId()->save();402 // 产å2403 $product2 = wei()->product();404 $product2->setOption('shippingTpl', $shippingTpl2);405 // è´ç©è½¦2406 $cart2 = wei()->cart()->fromArray([407 'quantity' => 5,408 ]);409 $cart2->setProduct($product2);410 $carts[] = $cart2;411 // å°å1412 $address = wei()->address()->fromArray(['city' => 'æ·±å³å¸']);413 $services = wei()->shippingTpl->getShippingServices($carts, $address);414 $this->assertEquals(2, count($services));415 // 10é¦ + 2ç» * (10 - 1)件 + 0ç» * 5件 = 28416 $this->assertEquals(['id' => '2', 'name' => 'å°åºèªæ', 'fee' => 28], $services[0]);417 // 8é¦ + 1ç» * (10 - 1)件 + 0ç» * 5件 = 17418 $this->assertEquals(['id' => '1', 'name' => 'å¿«é', 'fee' => 17], $services[1]);419 }420 /**421 * å
é®çè¿è´¹æ¨¡æ¿,è·åè¿è´¹ä¿¡æ¯æ¶,è¿åå
é®422 */423 public function testGetFreeShippingConfig()424 {425 $tpl = $this->getFreeShippingTpl();426 $config = $tpl->getShippingConfig();...
user_model.php
Source:user_model.php
1<?php2 class User_model extends CI_model{3 function index($fromarray,$index,$data){4 $this->load->view('index/'.$index, $data);5 }6 function product_amc(){7 return $new_customer = $this->db->get('new_customer')->result_array();8 }9 function service_amc(){10 return $new_customer = $this->db->get('new_customer')->result_array();11 }12 function managecustomer(){13 return $new_customer = $this->db->get('new_customer')->result_array();14 }15 function manageexecutive(){16 return $new_executive = $this->db->get('new_executive')->result_array();17 }18 function manage_product(){19 return $new_product = $this->db->get('new_product')->result_array();20 }21 function manage_product_group(){22 return $new_product_group = $this->db->get('new_product_group')->result_array();23 }24 function manage_product_model(){25 return $new_product_model = $this->db->get('new_product_model')->result_array();26 }27 function manage_product_serial(){28 return $new_product_serial = $this->db->get('new_product_serial')->result_array();29 }30 function addnewcustomer($fromarray){31 $this->db->insert('new_customer',$fromarray);32 }33 function addproductgroup($fromarray){34 $this->db->insert('new_product_group',$fromarray);35 }36 function addproductmodel($fromarray){37 $this->db->insert('new_product_model',$fromarray);38 }39 function addproductserial($fromarray){40 $this->db->insert('new_product_serial',$fromarray);41 }42 function addproduct($fromarray){43 $this->db->insert('new_product',$fromarray);44 }45 function addnewexecutive($fromarray)46 {47 $this->db->insert('new_executive',$fromarray);48 //$this->db->insert('new_executive',$fromarray);49 }50 function update_customer($userid,$fromarray)51 {52 $this->db->where('sr_no',$userid);53 $this->db->update('new_customer',$fromarray); // update users SET name=? ,email = ? where sr_no = ?;54 }55 function update_executive($userid,$fromarray)56 {57 $this->db->where('sr_no',$userid);58 $this->db->update('new_executive',$fromarray); // update users SET name=? ,email = ? where sr_no = ?;59 }60 function update_product($userid,$fromarray)61 {62 $this->db->where('sr_no',$userid);63 $this->db->update('new_product',$fromarray); // update users SET name=? ,email = ? where sr_no = ?;64 }65 function update_product_group($userid,$fromarray)66 {67 $this->db->where('sr_no',$userid);68 $this->db->update('new_product_group',$fromarray); // update users SET name=? ,email = ? where sr_no = ?;69 }70 function update_product_model($userid,$fromarray)71 {72 $this->db->where('sr_no',$userid);73 $this->db->update('new_product_model',$fromarray); // update users SET name=? ,email = ? where sr_no = ?;74 }75 function update_product_serial($userid,$fromarray)76 {77 $this->db->where('sr_no',$userid);78 $this->db->update('new_product_serial',$fromarray); // update users SET name=? ,email = ? where sr_no = ?;79 }80 function delete_customer($userid)81 {82 $this->db->where('sr_no',$userid);83 $this->db->delete('new_customer');84 }85 function delete_executive($userid)86 {87 $this->db->where('sr_no',$userid);88 $this->db->delete('new_executive');89 }90 function delete_product($userid)91 {92 $this->db->where('sr_no',$userid);93 $this->db->delete('new_product');94 }95 function delete_product_group($userid)96 {97 $this->db->where('sr_no',$userid);98 $this->db->delete('new_product_group');99 }100 function delete_product_model($userid)101 {102 $this->db->where('sr_no',$userid);103 $this->db->delete('new_product_model');104 }105 function delete_product_serial($userid)106 {107 $this->db->where('sr_no',$userid);108 $this->db->delete('new_product_serial');109 }110 function get_customer($userid)111 {112 $this->db->where('sr_no',$userid);113 return $user = $this->db->get('new_customer')->row_array(); // select * from users where sr_no = ?;114 }115 function get_executive($userid)116 {117 $this->db->where('sr_no',$userid);118 return $user = $this->db->get('new_executive')->row_array(); // select * from users where sr_no = ?;119 }120 function get_product($userid)121 {122 $this->db->where('sr_no',$userid);123 return $user = $this->db->get('new_product')->row_array(); // select * from users where sr_no = ?;124 }125 function get_product_group($userid)126 {127 $this->db->where('sr_no',$userid);128 return $user = $this->db->get('new_product_group')->row_array(); // select * from users where sr_no = ?;129 }130 function get_product_model($userid)131 {132 $this->db->where('sr_no',$userid);133 return $user = $this->db->get('new_product_model')->row_array(); // select * from users where sr_no = ?;134 }135 function get_product_serial($userid)136 {137 $this->db->where('sr_no',$userid);138 return $user = $this->db->get('new_product_serial')->row_array(); // select * from users where sr_no = ?;139 }140 }141?>...
fromArray
Using AI Code Generation
1$products = new Product();2$products->fromArray($data);3$products = new Product();4$products->fromArray($data);5$products = new Product();6$products->fromArray($data);7$products = new Product();8$products->fromArray($data);9$products = new Product();10$products->fromArray($data);11$products = new Product();12$products->fromArray($data);13$products = new Product();14$products->fromArray($data);15$products = new Product();16$products->fromArray($data);17$products = new Product();18$products->fromArray($data);19$products = new Product();20$products->fromArray($data);21$products = new Product();22$products->fromArray($data);23$products = new Product();24$products->fromArray($data);25$products = new Product();26$products->fromArray($data);27$products = new Product();28$products->fromArray($data);29$products = new Product();30$products->fromArray($data);31$products = new Product();32$products->fromArray($data);
fromArray
Using AI Code Generation
1$products = array();2$products[] = new Product('Tires', 100);3$products[] = new Product('Oil', 10);4$products[] = new Product('Spark Plugs', 4);5$productArray = array();6foreach ($products as $product) {7$productArray[] = $product->toArray();8}9$json = json_encode($productArray);10header('Content-Type: application/json');11echo $json;12$products = array();13$products[] = new Product('Tires', 100);14$products[] = new Product('Oil', 10);15$products[] = new Product('Spark Plugs', 4);16$productArray = array();17foreach ($products as $product) {18$productArray[] = $product->toArray();19}20$json = json_encode($productArray);21header('Content-Type: application/json');22echo $json;23$products = array();24$products[] = new Product('Tires', 100);25$products[] = new Product('Oil', 10);26$products[] = new Product('Spark Plugs', 4);27$productArray = array();28foreach ($products as $product) {29$productArray[] = $product->toArray();30}31$json = json_encode($productArray);32header('Content-Type: application/json');33echo $json;34$products = array();35$products[] = new Product('Tires', 100);36$products[] = new Product('Oil', 10);37$products[] = new Product('Spark Plugs', 4);38$productArray = array();39foreach ($products as $product) {40$productArray[] = $product->toArray();41}42$json = json_encode($productArray);43header('Content-Type: application/json');44echo $json;
fromArray
Using AI Code Generation
1include 'Product.php';2$product = new Product();3$product->fromArray($_POST);4$product->save();5include 'Product.php';6$product = new Product();7$product->fromArray($_POST);8$product->save();9include 'Product.php';10$product = new Product();11$product->fromArray($_POST);12$product->save();13include 'Product.php';14$product = new Product();15$product->fromArray($_POST);16$product->save();17include 'Product.php';18$product = new Product();19$product->fromArray($_POST);20$product->save();21include 'Product.php';22$product = new Product();23$product->fromArray($_POST);24$product->save();25include 'Product.php';26$product = new Product();27$product->fromArray($_POST);28$product->save();29include 'Product.php';30$product = new Product();31$product->fromArray($_POST);32$product->save();33include 'Product.php';34$product = new Product();35$product->fromArray($_POST);36$product->save();37include 'Product.php';38$product = new Product();39$product->fromArray($_POST);40$product->save();41include 'Product.php';42$product = new Product();43$product->fromArray($_POST);44$product->save();45include 'Product.php';46$product = new Product();47$product->fromArray($_POST);48$product->save();
fromArray
Using AI Code Generation
1$myProduct = new Product();2$myProduct->fromArray($myArray);3echo $myProduct->getPrice();4$myProduct = new Product();5$myProduct->fromArray($myArray);6echo $myProduct->getPrice();7$myProduct = new Product();8$myProduct->fromArray($myArray);9echo $myProduct->getPrice();10$myProduct = new Product();11$myProduct->fromArray($myArray);12echo $myProduct->getPrice();13$myProduct = new Product();14$myProduct->fromArray($myArray);15echo $myProduct->getPrice();16$myProduct = new Product();17$myProduct->fromArray($myArray);18echo $myProduct->getPrice();19$myProduct = new Product();20$myProduct->fromArray($myArray);21echo $myProduct->getPrice();22$myProduct = new Product();23$myProduct->fromArray($myArray);24echo $myProduct->getPrice();25$myProduct = new Product();26$myProduct->fromArray($myArray);27echo $myProduct->getPrice();28$myProduct = new Product();29$myProduct->fromArray($myArray);30echo $myProduct->getPrice();31$myProduct = new Product();32$myProduct->fromArray($myArray);33echo $myProduct->getPrice();34$myProduct = new Product();35$myProduct->fromArray($myArray);36echo $myProduct->getPrice();
fromArray
Using AI Code Generation
1require_once 'Product.php';2$products = array(3array('code' => 'P001', 'name' => 'Pen', 'price' => 100),4array('code' => 'P002', 'name' => 'Pencil', 'price' => 50),5array('code' => 'P003', 'name' => 'Eraser', 'price' => 25)6);7$prod = new Product();8$prod->fromArray($products);9$prod->printProduct();
fromArray
Using AI Code Generation
1$prod = new Product;2$prod->fromArray($_POST);3$prod = new Product;4$prod->fromArray($_POST);5$prod = new Product;6$prod->fromArray($_POST);7$prod = new Product;8$prod->fromArray($_POST);9$prod = new Product;10$prod->fromArray($_POST);11$prod = new Product;12$prod->fromArray($_POST);13$prod = new Product;14$prod->fromArray($_POST);15$prod = new Product;16$prod->fromArray($_POST);17$prod = new Product;18$prod->fromArray($_POST);19$prod = new Product;20$prod->fromArray($_POST);21$prod = new Product;22$prod->fromArray($_POST);23$prod = new Product;24$prod->fromArray($_POST);
fromArray
Using AI Code Generation
1require_once 'Product.php';2$product = new Product();3$product->fromArray(array(4));5var_dump($product);6require_once 'Product.php';7$product = new Product();8$product->fromArray(array(9));10var_dump($product);11require_once 'Product.php';12$product = new Product();13$product->fromArray(array(14));15var_dump($product);16require_once 'Product.php';17$product = new Product();18$product->fromArray(array(19));20var_dump($product);21require_once 'Product.php';22$product = new Product();23$product->fromArray(array(24));25var_dump($product);26require_once 'Product.php';27$product = new Product();28$product->fromArray(array(29));30var_dump($product);31require_once 'Product.php';32$product = new Product();33$product->fromArray(array(34));35var_dump($product);36require_once 'Product.php';37$product = new Product();38$product->fromArray(array(
fromArray
Using AI Code Generation
1$prod = new Product();2$prod->fromArray(array(3));4$prod = new Product();5$prod->fromArray(array(6));7$prod = new Product();8$prod->fromArray(array(9));10$prod = new Product();11$prod->fromArray(array(12));13$prod = new Product();14$prod->fromArray(array(15));16$prod = new Product();17$prod->fromArray(array(18));19$prod = new Product();20$prod->fromArray(array(21));
fromArray
Using AI Code Generation
1include("Product.php");2$prod = new Product;3$prod->fromArray(array("name"=>"iPhone", "price"=>499));4echo $prod->name;5echo $prod->price;6class Product{7 public $name;8 public $price;9 public function fromArray($data){10 foreach($data as $key => $value){11 $this->$key = $value;12 }13 }14}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with fromArray on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!