public function testValidateCorrect() { $model = new Article(['name' => 'name', 'text' => 'text', 'created_at' => 'created_at', 'updated_at' => 'updated_at', 'user_id' => null]); $this->specify('event wrong', function () use($model) { expect('model should not validate', $model->validate())->true(); }); }
/** * Updates an article * @param Article $article Article to update * @return Response */ public function updateArticle($article) { $data = Input::all(); if ($article->validate($data)) { $article->update($data); return View::make('admin.articles.edit')->withArticle($article)->withSuccess('<strong>Article updated successfully.</strong>'); } Input::flash(); return View::make('admin.articles.edit')->withArticle($article)->withErrors($article->getValidator()); }