/** * Finds the MediaComment model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * * @param integer $id * * @return MediaComment the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MediaComment::findOne($id)) !== null) { return $model; } throw new NotFoundHttpException(Yii::t('writesdown', 'The requested page does not exist.')); }
/** * @param AcceptanceTester $I */ public function testUpdate(AcceptanceTester $I) { $I->wantTo('ensure that update media-comment works'); $updatePage = UpdatePage::openBy($I); $I->see('Update Media Comment 1', 'h1'); $I->amGoingTo('submit media-comment with no correct email & url'); $updatePage->submit(['author' => 'Tester', 'email' => 'tester.author@test', 'url' => 'http://.com']); $I->expectTo('see that email & url not correct'); $I->see('Email is not a valid email address.', '.help-block'); $I->see('URL is not a valid URL.', '.help-block'); $I->amGoingTo('submit media-comment with correct data'); $updatePage->submit(['author' => 'Tester', 'email' => '*****@*****.**', 'url' => 'http://tester.com']); $I->expect('media-comment updated'); $I->dontSee('Email is not a valid email address.', '.help-block'); $I->dontSee('URL is not a valid URL.', '.help-block'); MediaComment::findOne(1)->updateAll(['author' => 'Mr. WritesDown', 'email' => '*****@*****.**', 'url' => 'http://www.writesdown.com']); }
/** * Finds the MediaComment model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * * @param integer $id * * @return MediaComment the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MediaComment::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }