/** * @param FunctionalTester $I */ public function testUpdate(FunctionalTester $I) { $I->wantTo('ensure that update page works'); $updatePage = UpdatePage::openBy($I); $I->see('Update Module: sitemap', 'h1'); $I->seeLink('Basic', '#'); $I->seeLink('Frontend', '#'); $I->seeLink('Backend', '#'); $I->amGoingTo('submit update module form with correct data'); $I->checkOption('#module-module_status'); $updatePage->submit(['module_name' => 'test', 'module_title' => 'Test']); $I->expect('module updated'); $I->see('Modules', 'h1'); $I->see('Test', '#module-grid-view'); Module::findOne(2)->updateAttributes(['module_name' => 'sitemap', 'module_title' => 'Sitemap', 'module_status' => '0']); }
/** * Finds the Module model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * * @param integer $id * * @return Module the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Module::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Finds the Module model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * * @param integer $id * @return Module the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Module::findOne($id)) !== null) { return $model; } throw new NotFoundHttpException(Yii::t('writesdown', 'The requested page does not exist.')); }