diff --git a/assets/AppAsset.php b/assets/AppAsset.php index c964d36..0e495a8 100644 --- a/assets/AppAsset.php +++ b/assets/AppAsset.php @@ -15,15 +15,15 @@ use yii\web\AssetBundle; */ class AppAsset extends AssetBundle { - public $basePath = '@webroot'; - public $baseUrl = '@web'; - public $css = [ - 'css/site.css', - ]; - public $js = [ - ]; - public $depends = [ - 'yii\web\YiiAsset', - 'yii\bootstrap\BootstrapAsset', - ]; + public $basePath = '@webroot'; + public $baseUrl = '@web'; + public $css = [ + 'css/site.css', + ]; + public $js = [ + ]; + public $depends = [ + 'yii\web\YiiAsset', + 'yii\bootstrap\BootstrapAsset', + ]; } diff --git a/commands/HelloController.php b/commands/HelloController.php index ce567dd..86ab8b8 100644 --- a/commands/HelloController.php +++ b/commands/HelloController.php @@ -19,12 +19,12 @@ use yii\console\Controller; */ class HelloController extends Controller { - /** - * This command echoes what you have entered as the message. - * @param string $message the message to be echoed. - */ - public function actionIndex($message = 'hello world') - { - echo $message . "\n"; - } + /** + * This command echoes what you have entered as the message. + * @param string $message the message to be echoed. + */ + public function actionIndex($message = 'hello world') + { + echo $message . "\n"; + } } diff --git a/config/console.php b/config/console.php index 1f58e42..f254858 100644 --- a/config/console.php +++ b/config/console.php @@ -6,24 +6,24 @@ $params = require(__DIR__ . '/params.php'); $db = require(__DIR__ . '/db.php'); return [ - 'id' => 'basic-console', - 'basePath' => dirname(__DIR__), - 'preload' => ['log'], - 'controllerNamespace' => 'app\commands', - 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'), - 'components' => [ - 'cache' => [ - 'class' => 'yii\caching\FileCache', - ], - 'log' => [ - 'targets' => [ - [ - 'class' => 'yii\log\FileTarget', - 'levels' => ['error', 'warning'], - ], - ], - ], - 'db' => $db, - ], - 'params' => $params, + 'id' => 'basic-console', + 'basePath' => dirname(__DIR__), + 'preload' => ['log'], + 'controllerNamespace' => 'app\commands', + 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'), + 'components' => [ + 'cache' => [ + 'class' => 'yii\caching\FileCache', + ], + 'log' => [ + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => ['error', 'warning'], + ], + ], + ], + 'db' => $db, + ], + 'params' => $params, ]; diff --git a/config/db.php b/config/db.php index b14e77e..c4c1252 100644 --- a/config/db.php +++ b/config/db.php @@ -1,9 +1,9 @@ 'yii\db\Connection', - 'dsn' => 'mysql:host=localhost;dbname=yii2basic', - 'username' => 'root', - 'password' => '', - 'charset' => 'utf8', + 'class' => 'yii\db\Connection', + 'dsn' => 'mysql:host=localhost;dbname=yii2basic', + 'username' => 'root', + 'password' => '', + 'charset' => 'utf8', ]; diff --git a/config/params.php b/config/params.php index 93cb368..6ebf279 100644 --- a/config/params.php +++ b/config/params.php @@ -1,5 +1,5 @@ 'admin@example.com', + 'adminEmail' => 'admin@example.com', ]; diff --git a/config/web.php b/config/web.php index 6f02f52..462c135 100644 --- a/config/web.php +++ b/config/web.php @@ -4,43 +4,43 @@ $params = require(__DIR__ . '/params.php'); $db = require(__DIR__ . '/db.php'); $config = [ - 'id' => 'basic', - 'basePath' => dirname(__DIR__), - 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'), - 'components' => [ - 'cache' => [ - 'class' => 'yii\caching\FileCache', - ], - 'user' => [ - 'identityClass' => 'app\models\User', - 'enableAutoLogin' => true, - ], - 'errorHandler' => [ - 'errorAction' => 'site/error', - ], - 'mail' => [ - 'class' => 'yii\swiftmailer\Mailer', - 'useFileTransport' => true, - ], - 'log' => [ - 'traceLevel' => YII_DEBUG ? 3 : 0, - 'targets' => [ - [ - 'class' => 'yii\log\FileTarget', - 'levels' => ['error', 'warning'], - ], - ], - ], - 'db' => $db, - ], - 'params' => $params, + 'id' => 'basic', + 'basePath' => dirname(__DIR__), + 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'), + 'components' => [ + 'cache' => [ + 'class' => 'yii\caching\FileCache', + ], + 'user' => [ + 'identityClass' => 'app\models\User', + 'enableAutoLogin' => true, + ], + 'errorHandler' => [ + 'errorAction' => 'site/error', + ], + 'mail' => [ + 'class' => 'yii\swiftmailer\Mailer', + 'useFileTransport' => true, + ], + 'log' => [ + 'traceLevel' => YII_DEBUG ? 3 : 0, + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => ['error', 'warning'], + ], + ], + ], + 'db' => $db, + ], + 'params' => $params, ]; if (YII_ENV_DEV) { - // configuration adjustments for 'dev' environment - $config['preload'][] = 'debug'; - $config['modules']['debug'] = 'yii\debug\Module'; - $config['modules']['gii'] = 'yii\gii\Module'; + // configuration adjustments for 'dev' environment + $config['preload'][] = 'debug'; + $config['modules']['debug'] = 'yii\debug\Module'; + $config['modules']['gii'] = 'yii\gii\Module'; } return $config; diff --git a/controllers/SiteController.php b/controllers/SiteController.php index 0d4d2f9..ebecd28 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -11,84 +11,86 @@ use app\models\ContactForm; class SiteController extends Controller { - public function behaviors() - { - return [ - 'access' => [ - 'class' => AccessControl::className(), - 'only' => ['logout'], - 'rules' => [ - [ - 'actions' => ['logout'], - 'allow' => true, - 'roles' => ['@'], - ], - ], - ], - 'verbs' => [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'logout' => ['post'], - ], - ], - ]; - } + public function behaviors() + { + return [ + 'access' => [ + 'class' => AccessControl::className(), + 'only' => ['logout'], + 'rules' => [ + [ + 'actions' => ['logout'], + 'allow' => true, + 'roles' => ['@'], + ], + ], + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'logout' => ['post'], + ], + ], + ]; + } - public function actions() - { - return [ - 'error' => [ - 'class' => 'yii\web\ErrorAction', - ], - 'captcha' => [ - 'class' => 'yii\captcha\CaptchaAction', - 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, - ], - ]; - } + public function actions() + { + return [ + 'error' => [ + 'class' => 'yii\web\ErrorAction', + ], + 'captcha' => [ + 'class' => 'yii\captcha\CaptchaAction', + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, + ], + ]; + } - public function actionIndex() - { - return $this->render('index'); - } + public function actionIndex() + { + return $this->render('index'); + } - public function actionLogin() - { - if (!\Yii::$app->user->isGuest) { - return $this->goHome(); - } + public function actionLogin() + { + if (!\Yii::$app->user->isGuest) { + return $this->goHome(); + } - $model = new LoginForm(); - if ($model->load(Yii::$app->request->post()) && $model->login()) { - return $this->goBack(); - } else { - return $this->render('login', [ - 'model' => $model, - ]); - } - } + $model = new LoginForm(); + if ($model->load(Yii::$app->request->post()) && $model->login()) { + return $this->goBack(); + } else { + return $this->render('login', [ + 'model' => $model, + ]); + } + } - public function actionLogout() - { - Yii::$app->user->logout(); - return $this->goHome(); - } + public function actionLogout() + { + Yii::$app->user->logout(); - public function actionContact() - { - $model = new ContactForm(); - if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) { - Yii::$app->session->setFlash('contactFormSubmitted'); - return $this->refresh(); - } else { - return $this->render('contact', [ - 'model' => $model, - ]); - } - } + return $this->goHome(); + } - public function actionAbout() - { - return $this->render('about'); - } + public function actionContact() + { + $model = new ContactForm(); + if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) { + Yii::$app->session->setFlash('contactFormSubmitted'); + + return $this->refresh(); + } else { + return $this->render('contact', [ + 'model' => $model, + ]); + } + } + + public function actionAbout() + { + return $this->render('about'); + } } diff --git a/mail/layouts/html.php b/mail/layouts/html.php index 8e2707d..a9689cc 100644 --- a/mail/layouts/html.php +++ b/mail/layouts/html.php @@ -10,14 +10,14 @@ use yii\helpers\Html; - - <?= Html::encode($this->title) ?> - head() ?> + + <?= Html::encode($this->title) ?> + head() ?> - beginBody() ?> - - endBody() ?> + beginBody() ?> + + endBody() ?> -endPage() ?> \ No newline at end of file +endPage() ?> diff --git a/models/ContactForm.php b/models/ContactForm.php index 1344562..29a5dd9 100644 --- a/models/ContactForm.php +++ b/models/ContactForm.php @@ -10,54 +10,55 @@ use yii\base\Model; */ class ContactForm extends Model { - public $name; - public $email; - public $subject; - public $body; - public $verifyCode; + public $name; + public $email; + public $subject; + public $body; + public $verifyCode; - /** - * @return array the validation rules. - */ - public function rules() - { - return [ - // name, email, subject and body are required - [['name', 'email', 'subject', 'body'], 'required'], - // email has to be a valid email address - ['email', 'email'], - // verifyCode needs to be entered correctly - ['verifyCode', 'captcha'], - ]; - } + /** + * @return array the validation rules. + */ + public function rules() + { + return [ + // name, email, subject and body are required + [['name', 'email', 'subject', 'body'], 'required'], + // email has to be a valid email address + ['email', 'email'], + // verifyCode needs to be entered correctly + ['verifyCode', 'captcha'], + ]; + } - /** - * @return array customized attribute labels - */ - public function attributeLabels() - { - return [ - 'verifyCode' => 'Verification Code', - ]; - } + /** + * @return array customized attribute labels + */ + public function attributeLabels() + { + return [ + 'verifyCode' => 'Verification Code', + ]; + } - /** - * Sends an email to the specified email address using the information collected by this model. - * @param string $email the target email address - * @return boolean whether the model passes validation - */ - public function contact($email) - { - if ($this->validate()) { - Yii::$app->mail->compose() - ->setTo($email) - ->setFrom([$this->email => $this->name]) - ->setSubject($this->subject) - ->setTextBody($this->body) - ->send(); - return true; - } else { - return false; - } - } + /** + * Sends an email to the specified email address using the information collected by this model. + * @param string $email the target email address + * @return boolean whether the model passes validation + */ + public function contact($email) + { + if ($this->validate()) { + Yii::$app->mail->compose() + ->setTo($email) + ->setFrom([$this->email => $this->name]) + ->setSubject($this->subject) + ->setTextBody($this->body) + ->send(); + + return true; + } else { + return false; + } + } } diff --git a/models/LoginForm.php b/models/LoginForm.php index 76cf1de..31b814e 100644 --- a/models/LoginForm.php +++ b/models/LoginForm.php @@ -10,65 +10,66 @@ use yii\base\Model; */ class LoginForm extends Model { - public $username; - public $password; - public $rememberMe = true; + public $username; + public $password; + public $rememberMe = true; - private $_user = false; + private $_user = false; - /** - * @return array the validation rules. - */ - public function rules() - { - return [ - // username and password are both required - [['username', 'password'], 'required'], - // rememberMe must be a boolean value - ['rememberMe', 'boolean'], - // password is validated by validatePassword() - ['password', 'validatePassword'], - ]; - } + /** + * @return array the validation rules. + */ + public function rules() + { + return [ + // username and password are both required + [['username', 'password'], 'required'], + // rememberMe must be a boolean value + ['rememberMe', 'boolean'], + // password is validated by validatePassword() + ['password', 'validatePassword'], + ]; + } - /** - * Validates the password. - * This method serves as the inline validation for password. - */ - public function validatePassword() - { - if (!$this->hasErrors()) { - $user = $this->getUser(); + /** + * Validates the password. + * This method serves as the inline validation for password. + */ + public function validatePassword() + { + if (!$this->hasErrors()) { + $user = $this->getUser(); - if (!$user || !$user->validatePassword($this->password)) { - $this->addError('password', 'Incorrect username or password.'); - } - } - } + if (!$user || !$user->validatePassword($this->password)) { + $this->addError('password', 'Incorrect username or password.'); + } + } + } - /** - * Logs in a user using the provided username and password. - * @return boolean whether the user is logged in successfully - */ - public function login() - { - if ($this->validate()) { - return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); - } else { - return false; - } - } + /** + * Logs in a user using the provided username and password. + * @return boolean whether the user is logged in successfully + */ + public function login() + { + if ($this->validate()) { + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); + } else { + return false; + } + } - /** - * Finds user by [[username]] - * - * @return User|null - */ - public function getUser() - { - if ($this->_user === false) { - $this->_user = User::findByUsername($this->username); - } - return $this->_user; - } + /** + * Finds user by [[username]] + * + * @return User|null + */ + public function getUser() + { + if ($this->_user === false) { + $this->_user = User::findByUsername($this->username); + } + + return $this->_user; + } } diff --git a/models/User.php b/models/User.php index fd0d0d4..5de7e20 100644 --- a/models/User.php +++ b/models/User.php @@ -4,98 +4,100 @@ namespace app\models; class User extends \yii\base\Object implements \yii\web\IdentityInterface { - public $id; - public $username; - public $password; - public $authKey; - public $accessToken; + public $id; + public $username; + public $password; + public $authKey; + public $accessToken; - private static $users = [ - '100' => [ - 'id' => '100', - 'username' => 'admin', - 'password' => 'admin', - 'authKey' => 'test100key', - 'accessToken' => '100-token', - ], - '101' => [ - 'id' => '101', - 'username' => 'demo', - 'password' => 'demo', - 'authKey' => 'test101key', - 'accessToken' => '101-token', - ], - ]; + private static $users = [ + '100' => [ + 'id' => '100', + 'username' => 'admin', + 'password' => 'admin', + 'authKey' => 'test100key', + 'accessToken' => '100-token', + ], + '101' => [ + 'id' => '101', + 'username' => 'demo', + 'password' => 'demo', + 'authKey' => 'test101key', + 'accessToken' => '101-token', + ], + ]; - /** - * @inheritdoc - */ - public static function findIdentity($id) - { - return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; - } + /** + * @inheritdoc + */ + public static function findIdentity($id) + { + return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; + } - /** - * @inheritdoc - */ - public static function findIdentityByAccessToken($token) - { - foreach (self::$users as $user) { - if ($user['accessToken'] === $token) { - return new static($user); - } - } - return null; - } + /** + * @inheritdoc + */ + public static function findIdentityByAccessToken($token) + { + foreach (self::$users as $user) { + if ($user['accessToken'] === $token) { + return new static($user); + } + } - /** - * Finds user by username - * - * @param string $username - * @return static|null - */ - public static function findByUsername($username) - { - foreach (self::$users as $user) { - if (strcasecmp($user['username'], $username) === 0) { - return new static($user); - } - } - return null; - } + return null; + } - /** - * @inheritdoc - */ - public function getId() - { - return $this->id; - } + /** + * Finds user by username + * + * @param string $username + * @return static|null + */ + public static function findByUsername($username) + { + foreach (self::$users as $user) { + if (strcasecmp($user['username'], $username) === 0) { + return new static($user); + } + } - /** - * @inheritdoc - */ - public function getAuthKey() - { - return $this->authKey; - } + return null; + } - /** - * @inheritdoc - */ - public function validateAuthKey($authKey) - { - return $this->authKey === $authKey; - } + /** + * @inheritdoc + */ + public function getId() + { + return $this->id; + } - /** - * Validates password - * - * @param string $password password to validate - * @return boolean if password provided is valid for current user - */ - public function validatePassword($password) - { - return $this->password === $password; - } + /** + * @inheritdoc + */ + public function getAuthKey() + { + return $this->authKey; + } + + /** + * @inheritdoc + */ + public function validateAuthKey($authKey) + { + return $this->authKey === $authKey; + } + + /** + * Validates password + * + * @param string $password password to validate + * @return boolean if password provided is valid for current user + */ + public function validatePassword($password) + { + return $this->password === $password; + } } diff --git a/requirements.php b/requirements.php index d470f99..b96e4d6 100644 --- a/requirements.php +++ b/requirements.php @@ -14,10 +14,10 @@ $frameworkPath = dirname(__FILE__) . '/vendor/yiisoft/yii2'; if (!is_dir($frameworkPath)) { - echo '

Error

'; - echo '

The path to yii framework seems to be incorrect.

'; - echo '

You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . '.

'; - echo '

Please refer to the README on how to install Yii.

'; + echo '

Error

'; + echo '

The path to yii framework seems to be incorrect.

'; + echo '

You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . '.

'; + echo '

Please refer to the README on how to install Yii.

'; } require_once($frameworkPath . '/requirements/YiiRequirementChecker.php'); @@ -27,84 +27,84 @@ $requirementsChecker = new YiiRequirementChecker(); * Adjust requirements according to your application specifics. */ $requirements = array( - // Database : - array( - 'name' => 'PDO extension', - 'mandatory' => true, - 'condition' => extension_loaded('pdo'), - 'by' => 'All DB-related classes', - ), - array( - 'name' => 'PDO SQLite extension', - 'mandatory' => false, - 'condition' => extension_loaded('pdo_sqlite'), - 'by' => 'All DB-related classes', - 'memo' => 'Required for SQLite database.', - ), - array( - 'name' => 'PDO MySQL extension', - 'mandatory' => false, - 'condition' => extension_loaded('pdo_mysql'), - 'by' => 'All DB-related classes', - 'memo' => 'Required for MySQL database.', - ), - array( - 'name' => 'PDO PostgreSQL extension', - 'mandatory' => false, - 'condition' => extension_loaded('pdo_pgsql'), - 'by' => 'All DB-related classes', - 'memo' => 'Required for PostgreSQL database.', - ), - // Cache : - array( - 'name' => 'Memcache extension', - 'mandatory' => false, - 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), - 'by' => 'CMemCache', - 'memo' => extension_loaded('memcached') ? 'To use memcached set CMemCache::useMemcached to true.' : '' - ), - array( - 'name' => 'APC extension', - 'mandatory' => false, - 'condition' => extension_loaded('apc'), - 'by' => 'CApcCache', - ), - // Additional PHP extensions : - array( - 'name' => 'Mcrypt extension', - 'mandatory' => false, - 'condition' => extension_loaded('mcrypt'), - 'by' => 'CSecurityManager', - 'memo' => 'Required by encrypt and decrypt methods.' - ), - // PHP ini : - 'phpSafeMode' => array( - 'name' => 'PHP safe mode', - 'mandatory' => false, - 'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"), - 'by' => 'File uploading and console command execution', - 'memo' => '"safe_mode" should be disabled at php.ini', - ), - 'phpExposePhp' => array( - 'name' => 'Expose PHP', - 'mandatory' => false, - 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"), - 'by' => 'Security reasons', - 'memo' => '"expose_php" should be disabled at php.ini', - ), - 'phpAllowUrlInclude' => array( - 'name' => 'PHP allow url include', - 'mandatory' => false, - 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"), - 'by' => 'Security reasons', - 'memo' => '"allow_url_include" should be disabled at php.ini', - ), - 'phpSmtp' => array( - 'name' => 'PHP mail SMTP', - 'mandatory' => false, - 'condition' => strlen(ini_get('SMTP'))>0, - 'by' => 'Email sending', - 'memo' => 'PHP mail SMTP server required', - ), + // Database : + array( + 'name' => 'PDO extension', + 'mandatory' => true, + 'condition' => extension_loaded('pdo'), + 'by' => 'All DB-related classes', + ), + array( + 'name' => 'PDO SQLite extension', + 'mandatory' => false, + 'condition' => extension_loaded('pdo_sqlite'), + 'by' => 'All DB-related classes', + 'memo' => 'Required for SQLite database.', + ), + array( + 'name' => 'PDO MySQL extension', + 'mandatory' => false, + 'condition' => extension_loaded('pdo_mysql'), + 'by' => 'All DB-related classes', + 'memo' => 'Required for MySQL database.', + ), + array( + 'name' => 'PDO PostgreSQL extension', + 'mandatory' => false, + 'condition' => extension_loaded('pdo_pgsql'), + 'by' => 'All DB-related classes', + 'memo' => 'Required for PostgreSQL database.', + ), + // Cache : + array( + 'name' => 'Memcache extension', + 'mandatory' => false, + 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), + 'by' => 'CMemCache', + 'memo' => extension_loaded('memcached') ? 'To use memcached set CMemCache::useMemcached to true.' : '' + ), + array( + 'name' => 'APC extension', + 'mandatory' => false, + 'condition' => extension_loaded('apc'), + 'by' => 'CApcCache', + ), + // Additional PHP extensions : + array( + 'name' => 'Mcrypt extension', + 'mandatory' => false, + 'condition' => extension_loaded('mcrypt'), + 'by' => 'CSecurityManager', + 'memo' => 'Required by encrypt and decrypt methods.' + ), + // PHP ini : + 'phpSafeMode' => array( + 'name' => 'PHP safe mode', + 'mandatory' => false, + 'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"), + 'by' => 'File uploading and console command execution', + 'memo' => '"safe_mode" should be disabled at php.ini', + ), + 'phpExposePhp' => array( + 'name' => 'Expose PHP', + 'mandatory' => false, + 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"), + 'by' => 'Security reasons', + 'memo' => '"expose_php" should be disabled at php.ini', + ), + 'phpAllowUrlInclude' => array( + 'name' => 'PHP allow url include', + 'mandatory' => false, + 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"), + 'by' => 'Security reasons', + 'memo' => '"allow_url_include" should be disabled at php.ini', + ), + 'phpSmtp' => array( + 'name' => 'PHP mail SMTP', + 'mandatory' => false, + 'condition' => strlen(ini_get('SMTP'))>0, + 'by' => 'Email sending', + 'memo' => 'PHP mail SMTP server required', + ), ); $requirementsChecker->checkYii()->check($requirements)->render(); diff --git a/tests/_config.php b/tests/_config.php index d9cc356..24ec1b5 100644 --- a/tests/_config.php +++ b/tests/_config.php @@ -3,12 +3,12 @@ * application configurations shared by all test types */ return [ - 'components' => [ - 'mail' => [ - 'useFileTransport' => true, - ], - 'urlManager' => [ - 'showScriptName' => true, - ], - ], + 'components' => [ + 'mail' => [ + 'useFileTransport' => true, + ], + 'urlManager' => [ + 'showScriptName' => true, + ], + ], ]; diff --git a/tests/_helpers/CodeHelper.php b/tests/_helpers/CodeHelper.php index 6448486..201503d 100644 --- a/tests/_helpers/CodeHelper.php +++ b/tests/_helpers/CodeHelper.php @@ -3,5 +3,5 @@ namespace Codeception\Module; class CodeHelper extends \Codeception\Module { - // here you can define custom methods for CodeGuy + // here you can define custom methods for CodeGuy } diff --git a/tests/_helpers/TestHelper.php b/tests/_helpers/TestHelper.php index 9558ff1..ae94187 100644 --- a/tests/_helpers/TestHelper.php +++ b/tests/_helpers/TestHelper.php @@ -3,5 +3,5 @@ namespace Codeception\Module; class TestHelper extends \Codeception\Module { - // here you can define custom methods for TestGuy + // here you can define custom methods for TestGuy } diff --git a/tests/_helpers/WebHelper.php b/tests/_helpers/WebHelper.php index b2953af..a8c7250 100644 --- a/tests/_helpers/WebHelper.php +++ b/tests/_helpers/WebHelper.php @@ -3,5 +3,5 @@ namespace Codeception\Module; class WebHelper extends \Codeception\Module { - // here you can define custom methods for WebGuy + // here you can define custom methods for WebGuy } diff --git a/tests/_pages/AboutPage.php b/tests/_pages/AboutPage.php index 5f9021f..77acdb8 100644 --- a/tests/_pages/AboutPage.php +++ b/tests/_pages/AboutPage.php @@ -6,5 +6,5 @@ use yii\codeception\BasePage; class AboutPage extends BasePage { - public $route = 'site/about'; + public $route = 'site/about'; } diff --git a/tests/_pages/ContactPage.php b/tests/_pages/ContactPage.php index 18015b5..24c8dfa 100644 --- a/tests/_pages/ContactPage.php +++ b/tests/_pages/ContactPage.php @@ -6,17 +6,17 @@ use yii\codeception\BasePage; class ContactPage extends BasePage { - public $route = 'site/contact'; + public $route = 'site/contact'; - /** - * @param array $contactData - */ - public function submit(array $contactData) - { - foreach ($contactData as $field => $value) { - $inputType = $field === 'body' ? 'textarea' : 'input'; - $this->guy->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value); - } - $this->guy->click('contact-button'); - } + /** + * @param array $contactData + */ + public function submit(array $contactData) + { + foreach ($contactData as $field => $value) { + $inputType = $field === 'body' ? 'textarea' : 'input'; + $this->guy->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value); + } + $this->guy->click('contact-button'); + } } diff --git a/tests/_pages/LoginPage.php b/tests/_pages/LoginPage.php index 503a420..c73d729 100644 --- a/tests/_pages/LoginPage.php +++ b/tests/_pages/LoginPage.php @@ -6,16 +6,16 @@ use yii\codeception\BasePage; class LoginPage extends BasePage { - public $route = 'site/login'; + public $route = 'site/login'; - /** - * @param string $username - * @param string $password - */ - public function login($username, $password) - { - $this->guy->fillField('input[name="LoginForm[username]"]', $username); - $this->guy->fillField('input[name="LoginForm[password]"]', $password); - $this->guy->click('login-button'); - } + /** + * @param string $username + * @param string $password + */ + public function login($username, $password) + { + $this->guy->fillField('input[name="LoginForm[username]"]', $username); + $this->guy->fillField('input[name="LoginForm[password]"]', $password); + $this->guy->click('login-button'); + } } diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml index b385284..2e35aa5 100644 --- a/tests/acceptance.suite.yml +++ b/tests/acceptance.suite.yml @@ -15,7 +15,7 @@ modules: - PhpBrowser # you can use WebDriver instead of PhpBrowser to test javascript and ajax. # This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium -# "restart" option is used by the WebDriver to start each time per test-file new session and cookies, +# "restart" option is used by the WebDriver to start each time per test-file new session and cookies, # it is useful if you want to login in your app in each test. # - WebDriver config: diff --git a/tests/acceptance/ContactCept.php b/tests/acceptance/ContactCept.php index 25f5735..e76ac9b 100644 --- a/tests/acceptance/ContactCept.php +++ b/tests/acceptance/ContactCept.php @@ -21,11 +21,11 @@ $I->see('The verification code is incorrect'); $I->amGoingTo('submit contact form with not correct email'); $contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester.email', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', + 'name' => 'tester', + 'email' => 'tester.email', + 'subject' => 'test subject', + 'body' => 'test content', + 'verifyCode' => 'testme', ]); $I->expectTo('see that email adress is wrong'); $I->dontSee('Name cannot be blank', '.help-inline'); @@ -36,14 +36,14 @@ $I->dontSee('The verification code is incorrect', '.help-inline'); $I->amGoingTo('submit contact form with correct data'); $contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester@example.com', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', + 'name' => 'tester', + 'email' => 'tester@example.com', + 'subject' => 'test subject', + 'body' => 'test content', + 'verifyCode' => 'testme', ]); if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium + $I->wait(3); // only for selenium } $I->dontSeeElement('#contact-form'); $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); diff --git a/tests/acceptance/LoginCept.php b/tests/acceptance/LoginCept.php index 5d6a387..07d1c45 100644 --- a/tests/acceptance/LoginCept.php +++ b/tests/acceptance/LoginCept.php @@ -23,7 +23,7 @@ $I->see('Incorrect username or password.'); $I->amGoingTo('try to login with correct credentials'); $loginPage->login('admin', 'admin'); if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium + $I->wait(3); // only for selenium } $I->expectTo('see user info'); $I->see('Logout (admin)'); diff --git a/tests/acceptance/_config.php b/tests/acceptance/_config.php index 4c306b3..857a804 100644 --- a/tests/acceptance/_config.php +++ b/tests/acceptance/_config.php @@ -1,13 +1,13 @@ [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance', - ], - ], - ] + require(__DIR__ . '/../../config/web.php'), + require(__DIR__ . '/../_config.php'), + [ + 'components' => [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance', + ], + ], + ] ); diff --git a/tests/acceptance/_console.php b/tests/acceptance/_console.php index f89eecf..03cdd1f 100644 --- a/tests/acceptance/_console.php +++ b/tests/acceptance/_console.php @@ -1,13 +1,13 @@ [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance', - ], - ], - ] + require(__DIR__ . '/../../config/console.php'), + require(__DIR__ . '/../_config.php'), + [ + 'components' => [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance', + ], + ], + ] ); diff --git a/tests/functional/ContactCept.php b/tests/functional/ContactCept.php index 14e6197..49d7735 100644 --- a/tests/functional/ContactCept.php +++ b/tests/functional/ContactCept.php @@ -21,11 +21,11 @@ $I->see('The verification code is incorrect'); $I->amGoingTo('submit contact form with not correct email'); $contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester.email', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', + 'name' => 'tester', + 'email' => 'tester.email', + 'subject' => 'test subject', + 'body' => 'test content', + 'verifyCode' => 'testme', ]); $I->expectTo('see that email adress is wrong'); $I->dontSee('Name cannot be blank', '.help-inline'); @@ -36,11 +36,11 @@ $I->dontSee('The verification code is incorrect', '.help-inline'); $I->amGoingTo('submit contact form with correct data'); $contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester@example.com', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', + 'name' => 'tester', + 'email' => 'tester@example.com', + 'subject' => 'test subject', + 'body' => 'test content', + 'verifyCode' => 'testme', ]); $I->dontSeeElement('#contact-form'); $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); diff --git a/tests/functional/_config.php b/tests/functional/_config.php index c2ecae0..512e802 100644 --- a/tests/functional/_config.php +++ b/tests/functional/_config.php @@ -5,13 +5,13 @@ $_SERVER['SCRIPT_FILENAME'] = TEST_ENTRY_FILE; $_SERVER['SCRIPT_NAME'] = TEST_ENTRY_URL; return yii\helpers\ArrayHelper::merge( - require(__DIR__ . '/../../config/web.php'), - require(__DIR__ . '/../_config.php'), - [ - 'components' => [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional', - ], - ], - ] + require(__DIR__ . '/../../config/web.php'), + require(__DIR__ . '/../_config.php'), + [ + 'components' => [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional', + ], + ], + ] ); diff --git a/tests/functional/_console.php b/tests/functional/_console.php index 2e674c4..abeee69 100644 --- a/tests/functional/_console.php +++ b/tests/functional/_console.php @@ -1,13 +1,13 @@ [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional', - ], - ], - ] + require(__DIR__ . '/../../config/console.php'), + require(__DIR__ . '/../_config.php'), + [ + 'components' => [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional', + ], + ], + ] ); diff --git a/tests/unit/_config.php b/tests/unit/_config.php index 45f1ef4..2559ef3 100644 --- a/tests/unit/_config.php +++ b/tests/unit/_config.php @@ -1,13 +1,13 @@ [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit', - ], - ], - ] + require(__DIR__ . '/../../config/web.php'), + require(__DIR__ . '/../_config.php'), + [ + 'components' => [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit', + ], + ], + ] ); diff --git a/tests/unit/_console.php b/tests/unit/_console.php index d2a233a..04272a3 100644 --- a/tests/unit/_console.php +++ b/tests/unit/_console.php @@ -1,13 +1,13 @@ [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit', - ], - ], - ] + require(__DIR__ . '/../../config/console.php'), + require(__DIR__ . '/../_config.php'), + [ + 'components' => [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit', + ], + ], + ] ); diff --git a/tests/unit/models/ContactFormTest.php b/tests/unit/models/ContactFormTest.php index c679717..d8a55ee 100644 --- a/tests/unit/models/ContactFormTest.php +++ b/tests/unit/models/ContactFormTest.php @@ -7,52 +7,52 @@ use yii\codeception\TestCase; class ContactFormTest extends TestCase { - use \Codeception\Specify; + use \Codeception\Specify; - protected function setUp() - { - parent::setUp(); - Yii::$app->mail->fileTransportCallback = function ($mailer, $message) { - return 'testing_message.eml'; - }; - } + protected function setUp() + { + parent::setUp(); + Yii::$app->mail->fileTransportCallback = function ($mailer, $message) { + return 'testing_message.eml'; + }; + } - protected function tearDown() - { - unlink($this->getMessageFile()); - parent::tearDown(); - } + protected function tearDown() + { + unlink($this->getMessageFile()); + parent::tearDown(); + } - public function testContact() - { - $model = $this->getMock('app\models\ContactForm', ['validate']); - $model->expects($this->once())->method('validate')->will($this->returnValue(true)); + public function testContact() + { + $model = $this->getMock('app\models\ContactForm', ['validate']); + $model->expects($this->once())->method('validate')->will($this->returnValue(true)); - $model->attributes = [ - 'name' => 'Tester', - 'email' => 'tester@example.com', - 'subject' => 'very important letter subject', - 'body' => 'body of current message', - ]; + $model->attributes = [ + 'name' => 'Tester', + 'email' => 'tester@example.com', + 'subject' => 'very important letter subject', + 'body' => 'body of current message', + ]; - $model->contact('admin@example.com'); + $model->contact('admin@example.com'); - $this->specify('email should be send', function () { - expect('email file should exist', file_exists($this->getMessageFile()))->true(); - }); + $this->specify('email should be send', function () { + expect('email file should exist', file_exists($this->getMessageFile()))->true(); + }); - $this->specify('message should contain correct data', function () use ($model) { - $emailMessage = file_get_contents($this->getMessageFile()); + $this->specify('message should contain correct data', function () use ($model) { + $emailMessage = file_get_contents($this->getMessageFile()); - expect('email should contain user name', $emailMessage)->contains($model->name); - expect('email should contain sender email', $emailMessage)->contains($model->email); - expect('email should contain subject', $emailMessage)->contains($model->subject); - expect('email should contain body', $emailMessage)->contains($model->body); - }); - } + expect('email should contain user name', $emailMessage)->contains($model->name); + expect('email should contain sender email', $emailMessage)->contains($model->email); + expect('email should contain subject', $emailMessage)->contains($model->subject); + expect('email should contain body', $emailMessage)->contains($model->body); + }); + } - private function getMessageFile() - { - return Yii::getAlias(Yii::$app->mail->fileTransportPath) . '/testing_message.eml'; - } + private function getMessageFile() + { + return Yii::getAlias(Yii::$app->mail->fileTransportPath) . '/testing_message.eml'; + } } diff --git a/tests/unit/models/LoginFormTest.php b/tests/unit/models/LoginFormTest.php index d1f6043..c2c28cc 100644 --- a/tests/unit/models/LoginFormTest.php +++ b/tests/unit/models/LoginFormTest.php @@ -8,59 +8,60 @@ use app\models\User; class LoginFormTest extends TestCase { - use \Codeception\Specify; + use \Codeception\Specify; - protected function tearDown() - { - Yii::$app->user->logout(); - parent::tearDown(); - } + protected function tearDown() + { + Yii::$app->user->logout(); + parent::tearDown(); + } - public function testLoginNoUser() - { - $model = $this->mockUser(null); + public function testLoginNoUser() + { + $model = $this->mockUser(null); - $model->username = 'some_username'; - $model->password = 'some_password'; + $model->username = 'some_username'; + $model->password = 'some_password'; - $this->specify('user should not be able to login, when there is no identity', function () use ($model) { - expect('model should not login user', $model->login())->false(); - expect('user should not be logged in', Yii::$app->user->isGuest)->true(); - }); - } + $this->specify('user should not be able to login, when there is no identity', function () use ($model) { + expect('model should not login user', $model->login())->false(); + expect('user should not be logged in', Yii::$app->user->isGuest)->true(); + }); + } - public function testLoginWrongPassword() - { - $model = $this->mockUser(new User); + public function testLoginWrongPassword() + { + $model = $this->mockUser(new User); - $model->username = 'demo'; - $model->password = 'wrong-password'; + $model->username = 'demo'; + $model->password = 'wrong-password'; - $this->specify('user should not be able to login with wrong password', function () use ($model) { - expect('model should not login user', $model->login())->false(); - expect('error message should be set', $model->errors)->hasKey('password'); - expect('user should not be logged in', Yii::$app->user->isGuest)->true(); - }); - } + $this->specify('user should not be able to login with wrong password', function () use ($model) { + expect('model should not login user', $model->login())->false(); + expect('error message should be set', $model->errors)->hasKey('password'); + expect('user should not be logged in', Yii::$app->user->isGuest)->true(); + }); + } - public function testLoginCorrect() - { - $model = $this->mockUser(new User(['password' => 'demo'])); + public function testLoginCorrect() + { + $model = $this->mockUser(new User(['password' => 'demo'])); - $model->username = 'demo'; - $model->password = 'demo'; + $model->username = 'demo'; + $model->password = 'demo'; - $this->specify('user should be able to login with correct credentials', function () use ($model) { - expect('model should login user', $model->login())->true(); - expect('error message should not be set', $model->errors)->hasntKey('password'); - expect('user should be logged in', Yii::$app->user->isGuest)->false(); - }); - } + $this->specify('user should be able to login with correct credentials', function () use ($model) { + expect('model should login user', $model->login())->true(); + expect('error message should not be set', $model->errors)->hasntKey('password'); + expect('user should be logged in', Yii::$app->user->isGuest)->false(); + }); + } - private function mockUser($user) - { - $loginForm = $this->getMock('app\models\LoginForm', ['getUser']); - $loginForm->expects($this->any())->method('getUser')->will($this->returnValue($user)); - return $loginForm; - } + private function mockUser($user) + { + $loginForm = $this->getMock('app\models\LoginForm', ['getUser']); + $loginForm->expects($this->any())->method('getUser')->will($this->returnValue($user)); + + return $loginForm; + } } diff --git a/tests/unit/models/UserTest.php b/tests/unit/models/UserTest.php index 109da73..8cd9215 100644 --- a/tests/unit/models/UserTest.php +++ b/tests/unit/models/UserTest.php @@ -6,12 +6,12 @@ use yii\codeception\TestCase; class UserTest extends TestCase { - protected function setUp() - { - parent::setUp(); - // uncomment the following to load fixtures for table tbl_user - //$this->loadFixtures(['tbl_user']); - } + protected function setUp() + { + parent::setUp(); + // uncomment the following to load fixtures for table tbl_user + //$this->loadFixtures(['tbl_user']); + } - // TODO add test methods here + // TODO add test methods here } diff --git a/views/layouts/main.php b/views/layouts/main.php index f32b53f..6af9564 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -15,53 +15,53 @@ AppAsset::register($this); - - - <?= Html::encode($this->title) ?> - head() ?> + + + <?= Html::encode($this->title) ?> + head() ?> beginBody() ?> -
- 'My Company', - 'brandUrl' => Yii::$app->homeUrl, - 'options' => [ - 'class' => 'navbar-inverse navbar-fixed-top', - ], - ]); - echo Nav::widget([ - 'options' => ['class' => 'navbar-nav navbar-right'], - 'items' => [ - ['label' => 'Home', 'url' => ['/site/index']], - ['label' => 'About', 'url' => ['/site/about']], - ['label' => 'Contact', 'url' => ['/site/contact']], - Yii::$app->user->isGuest ? - ['label' => 'Login', 'url' => ['/site/login']] : - ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', - 'url' => ['/site/logout'], - 'linkOptions' => ['data-method' => 'post']], - ], - ]); - NavBar::end(); - ?> +
+ 'My Company', + 'brandUrl' => Yii::$app->homeUrl, + 'options' => [ + 'class' => 'navbar-inverse navbar-fixed-top', + ], + ]); + echo Nav::widget([ + 'options' => ['class' => 'navbar-nav navbar-right'], + 'items' => [ + ['label' => 'Home', 'url' => ['/site/index']], + ['label' => 'About', 'url' => ['/site/about']], + ['label' => 'Contact', 'url' => ['/site/contact']], + Yii::$app->user->isGuest ? + ['label' => 'Login', 'url' => ['/site/login']] : + ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', + 'url' => ['/site/logout'], + 'linkOptions' => ['data-method' => 'post']], + ], + ]); + NavBar::end(); + ?> -
- isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], - ]) ?> - -
-
+
+ isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], + ]) ?> + +
+
- + endBody() ?> diff --git a/views/site/about.php b/views/site/about.php index 0608dd2..58969ab 100644 --- a/views/site/about.php +++ b/views/site/about.php @@ -8,11 +8,11 @@ $this->title = 'About'; $this->params['breadcrumbs'][] = $this->title; ?>
-

title) ?>

+

title) ?>

-

- This is the About page. You may modify the following file to customize its content: -

+

+ This is the About page. You may modify the following file to customize its content: +

- +
diff --git a/views/site/contact.php b/views/site/contact.php index bcaf542..6d70462 100644 --- a/views/site/contact.php +++ b/views/site/contact.php @@ -12,47 +12,47 @@ $this->title = 'Contact'; $this->params['breadcrumbs'][] = $this->title; ?>
-

title) ?>

+

title) ?>

- session->hasFlash('contactFormSubmitted')): ?> + session->hasFlash('contactFormSubmitted')): ?> -
- Thank you for contacting us. We will respond to you as soon as possible. -
+
+ Thank you for contacting us. We will respond to you as soon as possible. +
-

- Note that if you turn on the Yii debugger, you should be able - to view the mail message on the mail panel of the debugger. - mail->useFileTransport): ?> - Because the application is in development mode, the email is not sent but saved as - a file under mail->fileTransportPath) ?>. - Please configure the useFileTransport property of the mail - application component to be false to enable email sending. - -

+

+ Note that if you turn on the Yii debugger, you should be able + to view the mail message on the mail panel of the debugger. + mail->useFileTransport): ?> + Because the application is in development mode, the email is not sent but saved as + a file under mail->fileTransportPath) ?>. + Please configure the useFileTransport property of the mail + application component to be false to enable email sending. + +

- + -

- If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. -

+

+ If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. +

-
-
- 'contact-form']); ?> - field($model, 'name') ?> - field($model, 'email') ?> - field($model, 'subject') ?> - field($model, 'body')->textArea(['rows' => 6]) ?> - field($model, 'verifyCode')->widget(Captcha::className(), [ - 'template' => '
{image}
{input}
', - ]) ?> -
- 'btn btn-primary', 'name' => 'contact-button']) ?> -
- -
-
+
+
+ 'contact-form']); ?> + field($model, 'name') ?> + field($model, 'email') ?> + field($model, 'subject') ?> + field($model, 'body')->textArea(['rows' => 6]) ?> + field($model, 'verifyCode')->widget(Captcha::className(), [ + 'template' => '
{image}
{input}
', + ]) ?> +
+ 'btn btn-primary', 'name' => 'contact-button']) ?> +
+ +
+
- +
diff --git a/views/site/error.php b/views/site/error.php index 1b7ce04..c172fd6 100644 --- a/views/site/error.php +++ b/views/site/error.php @@ -13,17 +13,17 @@ $this->title = $name; ?>
-

title) ?>

+

title) ?>

-
- -
+
+ +
-

- The above error occurred while the Web server was processing your request. -

-

- Please contact us if you think this is a server error. Thank you. -

+

+ The above error occurred while the Web server was processing your request. +

+

+ Please contact us if you think this is a server error. Thank you. +

diff --git a/views/site/index.php b/views/site/index.php index bcb2278..6b6394e 100644 --- a/views/site/index.php +++ b/views/site/index.php @@ -6,48 +6,48 @@ $this->title = 'My Yii Application'; ?>
-
-

Congratulations!

+
+

Congratulations!

-

You have successfully created your Yii-powered application.

+

You have successfully created your Yii-powered application.

-

Get started with Yii

-
+

Get started with Yii

+
-
+
-
-
-

Heading

+
+
+

Heading

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

-

Yii Documentation »

-
-
-

Heading

+

Yii Documentation »

+
+
+

Heading

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

-

Yii Forum »

-
-
-

Heading

+

Yii Forum »

+
+
+

Heading

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

-

Yii Extensions »

-
-
+

Yii Extensions »

+
+
-
+
diff --git a/views/site/login.php b/views/site/login.php index 7d14c54..80cc548 100644 --- a/views/site/login.php +++ b/views/site/login.php @@ -11,37 +11,37 @@ $this->title = 'Login'; $this->params['breadcrumbs'][] = $this->title; ?>
-

title) ?>

+

title) ?>

-

Please fill out the following fields to login:

+

Please fill out the following fields to login:

- 'login-form', - 'options' => ['class' => 'form-horizontal'], - 'fieldConfig' => [ - 'template' => "{label}\n
{input}
\n
{error}
", - 'labelOptions' => ['class' => 'col-lg-1 control-label'], - ], - ]); ?> + 'login-form', + 'options' => ['class' => 'form-horizontal'], + 'fieldConfig' => [ + 'template' => "{label}\n
{input}
\n
{error}
", + 'labelOptions' => ['class' => 'col-lg-1 control-label'], + ], + ]); ?> - field($model, 'username') ?> + field($model, 'username') ?> - field($model, 'password')->passwordInput() ?> + field($model, 'password')->passwordInput() ?> - field($model, 'rememberMe', [ - 'template' => "
{input}
\n
{error}
", - ])->checkbox() ?> + field($model, 'rememberMe', [ + 'template' => "
{input}
\n
{error}
", + ])->checkbox() ?> -
-
- 'btn btn-primary', 'name' => 'login-button']) ?> -
-
+
+
+ 'btn btn-primary', 'name' => 'login-button']) ?> +
+
- + -
- You may login with admin/admin or demo/demo.
- To modify the username/password, please check out the code app\models\User::$users. -
+
+ You may login with admin/admin or demo/demo.
+ To modify the username/password, please check out the code app\models\User::$users. +
diff --git a/web/index-test.php b/web/index-test.php index b5ed695..326608d 100644 --- a/web/index-test.php +++ b/web/index-test.php @@ -2,7 +2,7 @@ // NOTE: Make sure this file is not accessible when deployed to production if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) { - die('You are not allowed to access this file.'); + die('You are not allowed to access this file.'); } defined('YII_DEBUG') or define('YII_DEBUG', true);