public function action_delete($id = null) { if ($form = Model_Form::find($id)) { $form->delete(); Session::set_flash('success', e('Deleted form #' . $id)); } else { Session::set_flash('error', e('Could not delete form #' . $id)); } Response::redirect('admin/form'); }
public function test_新規データをテーブルに保存する() { $data = array('name' => '藤原義孝', 'email' => '*****@*****.**', 'comment' => '君がため 惜しからざりし 命さえ 長くもがなと 思ひけるかな', 'ip_address' => '10.11.12.13', 'user_agent' => 'Mozilla/2.02 (Macintosh; I; PPC)'); $form = Model_Form::forge($data); // 新規データをデータベースに挿入 $ret = $form->save(); // 挿入されたデータをデータベースから検索 $form = Model_Form::find($form->id); foreach ($data as $field => $value) { $this->assertEquals($value, $form[$field]); } }
public function test_送信したデータの検証() { $form = Model_Form::find(4); foreach (static::$post as $field => $value) { $this->assertEquals($value, $form[$field]); } }