$name, 'active' => 1, 'delivery' => 1, 'credit' => 1, 'delivery_fee' => '1.5', 'confirmation' => 0, 'community' => 'test', 'timezone' => 'America/Los_Angeles' ]); $r->save(); $u = new User([ 'name' => $name, 'phone' => '_PHONE_', 'address' => '123 main', 'active' => 1 ]); $u->save(); $d = new Dish([ 'name' => $name, 'price' => '10', 'id_restaurant' => $r->id_restaurant, 'active' => 1 ]); $d->save(); $o = new Order([ 'id_restaurant' => $r->id_restaurant, 'id_user' => $u->id_user, 'date' => date('Y-m-d H:i:s'), 'name' => $u->name, 'phone' => $u->phone, // 'env' => 'live', // 'processor' => 'balanced', // 'type' => 'web', 'tax' => '8', 'tip' => '14.25', 'final_price_plus_delivery_markup' => '148.71', 'final_price' => '148.71', 'price_plus_delivery_markup' => '123', 'price' => '123' ]); $o->save(); $od = new Order_Dish([ 'id_order' => $o->id_order, 'id_dish' => $d->id_dish ]); $od->save(); } public static function tearDownAfterClass() { $name = get_called_class(); Restaurant::q('select * from restaurant where name=?', [$name])->delete(); User::q('select * from `user` where name=?', [$name])->delete(); Order_Dish::q(' select order_dish.* from order_dish left join `order` using(id_order) where `order`.name=? ',[$name])->delete(); Order::q('select * from `order` where name=?', [$name])->delete(); Dish::q('select * from dish where name=?', [$name])->delete(); } public function setUp() { $name = get_called_class(); $this->order = Order::q('select * from `order` where name=? limit 1', [$name])->get(0); $this->order = Order::q('select * from `order` where name=? limit 1', [$name])->get(0); } public function testFaxNotification() { if (!$this->order->id_order) { return $this->assertTrue('No id_order'); } $n = new Notification([ 'value' => '6462161341', 'active' => 1, 'type' => 'fax' ]); $status = $n->send($this->order); /* $temp = tempnam('/tmp','fax'); file_put_contents($temp, $mail->message()); rename($temp, $temp.'.html'); echo file_get_contents($temp.'.html'); $fax = new Phaxio( [ 'to' => '6462161341', 'file' => $temp.'.html' ] ); unlink($temp.'.html'); exit; */ $this->assertTrue($status); } }