本文整理汇总了PHP中common\models\Option::up方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::up方法的具体用法?PHP Option::up怎么用?PHP Option::up使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\Option
的用法示例。
在下文中一共展示了Option::up方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGroup
public function testGroup(FunctionalTester $I)
{
$I->wantTo('ensure that setting works');
$I->amOnPage(Url::to(['/setting/group', 'id' => 'general']));
$I->see('General Settings', 'h1');
$I->amGoingTo('update site title and tag line');
$I->fillField('input[name="Option[sitetitle][option_value]"]', 'My New Website');
$I->fillField('input[name="Option[tagline][option_value]"]', 'My New Website Tagline');
$I->click('Save');
$I->expectTo('see success message');
$I->see('Settings successfully saved.');
Option::up('sitetitle', 'WritesDown');
Option::up('tagline', 'CMS Built with Yii Framework');
}
示例2: testIndex
/**
* @param AcceptanceTester $I
*/
public function testIndex(AcceptanceTester $I)
{
$I->wantTo('ensure that index theme works');
$I->amOnPage(Url::to(['/theme/index']));
$I->see('Themes', 'h1');
$I->seeLink('Available Themes');
$I->seeLink('Add New Theme');
if (method_exists($I, 'acceptPopup') && method_exists($I, 'wait')) {
$I->amGoingTo('activate theme');
$I->click('a[href="' . Url::to(['/theme/install', 'theme' => 'writesdown']) . '"]');
$I->acceptPopup();
$I->wait(3);
$I->expectTo('see theme installed');
$I->see('Installed');
Option::up('theme', 'default');
}
}
示例3: testSignup
/**
* @param AcceptanceTester $I
*/
public function testSignup(AcceptanceTester $I)
{
Option::up('allow_signup', '1');
$I->wantTo('ensure that signup works');
$signupPage = SignupPage::openBy($I);
$I->see('Register a new membership', 'p');
$I->amGoingTo('submit signup form with no data');
$signupPage->submit([]);
$I->expectTo('see validations error');
$I->see('Username cannot be blank.', '.help-block');
$I->see('Email cannot be blank.', '.help-block');
$I->see('Password cannot be blank.', '.help-block');
$I->amGoingTo('submit signup form with no correct email and password');
$signupPage->submit(['username' => 'newuser', 'email' => 'newuser.email', 'password' => 'pass']);
$I->expectTo('see that email and password are not correct.');
$I->dontSee('Username cannot be blank.', '.help-block');
$I->see('Email is not a valid email address.', '.help-block');
$I->see('Password should contain at least 6 characters.', '.help-block');
$I->amGoingTo('submit signup form with correct data');
$signupPage->submit(['username' => 'newuser', 'email' => 'newuser@writesdown.dev', 'password' => 'password']);
$I->expect('new user saved.');
$I->dontSee('Username cannot be blank.', '.help-block');
$I->dontSee('Email is not a valid email address.', '.help-block');
$I->dontSee('Password should contain at least 6 characters.', '.help-block');
User::deleteAll(['username' => 'newuser']);
Option::up('allow_signup', '0');
}
示例4: actionGroup
/**
* Render option page for specific group of option.
* It will use group file if exist.
*
* @param string $id
*
* @return mixed
*/
public function actionGroup($id)
{
$model = $this->findModelByGroup($id);
if ($options = Yii::$app->request->post('Option')) {
foreach ($options as $optionName => $option) {
Option::up($optionName, $option['option_value']);
}
Yii::$app->getSession()->setFlash('success', Yii::t('writesdown', 'Settings successfully saved.'));
return $this->redirect(['group', 'id' => $id]);
}
if (is_file($this->getViewPath() . '/' . strtolower($id) . '.php')) {
return $this->render(strtolower($id), ['model' => (object) $model, 'group' => $id]);
}
return $this->redirect(['index']);
}
示例5: actionGroup
/**
* Render option page for specific group of option.
* It will use group file if exist.
*
* @param string $id group name
*
* @return string|\yii\web\Response
* @throws \yii\web\NotFoundHttpException
*/
public function actionGroup($id)
{
$model = Option::find()->where(['option_group' => $id])->indexBy('option_name')->all();
if ($options = Yii::$app->request->post('Option')) {
foreach ($options as $option_name => $option) {
Option::up($option_name, $option['option_value']);
}
Yii::$app->getSession()->setFlash('success', Yii::t('writesdown', 'Settings successfully saved.'));
return $this->redirect(['group', 'id' => $id]);
}
if ($model) {
if (is_file($viewFile = $this->getViewPath() . '/' . strtolower($id) . '.php')) {
return $this->render(strtolower($id), ['model' => (object) $model, 'group' => $id]);
} else {
return $this->redirect(['index']);
}
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}