diff --git a/backend/config/main.php b/backend/config/main.php index 16ddc61df8..38d02b0a33 100644 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -1,4 +1,5 @@ 'admin@example.com', ]; diff --git a/backend/config/test.php b/backend/config/test.php index 411b05f49c..8016d71775 100644 --- a/backend/config/test.php +++ b/backend/config/test.php @@ -1,4 +1,5 @@ 'app-backend-tests', 'components' => [ diff --git a/backend/tests/_data/login_data.php b/backend/tests/_data/login_data.php index 32aef6ea36..841e279485 100644 --- a/backend/tests/_data/login_data.php +++ b/backend/tests/_data/login_data.php @@ -1,4 +1,5 @@ 'erau', diff --git a/backend/tests/_support/FunctionalTester.php b/backend/tests/_support/FunctionalTester.php index a2bb8cb56a..b354ce6c43 100644 --- a/backend/tests/_support/FunctionalTester.php +++ b/backend/tests/_support/FunctionalTester.php @@ -20,7 +20,7 @@ class FunctionalTester extends \Codeception\Actor { use _generated\FunctionalTesterActions; - /** - * Define custom actions here - */ + /** + * Define custom actions here + */ } diff --git a/backend/tests/_support/UnitTester.php b/backend/tests/_support/UnitTester.php index 7cc4976edf..f5e730423c 100644 --- a/backend/tests/_support/UnitTester.php +++ b/backend/tests/_support/UnitTester.php @@ -20,7 +20,7 @@ class UnitTester extends \Codeception\Actor { use _generated\UnitTesterActions; - /** - * Define custom actions here - */ + /** + * Define custom actions here + */ } diff --git a/backend/tests/functional/LoginCest.php b/backend/tests/functional/LoginCest.php index 0716289a7f..d5eea5cbcd 100644 --- a/backend/tests/functional/LoginCest.php +++ b/backend/tests/functional/LoginCest.php @@ -26,7 +26,7 @@ public function _fixtures() ] ]; } - + /** * @param FunctionalTester $I */ diff --git a/backend/tests/functional/_bootstrap.php b/backend/tests/functional/_bootstrap.php index 30ed54b830..933ad4f3b2 100644 --- a/backend/tests/functional/_bootstrap.php +++ b/backend/tests/functional/_bootstrap.php @@ -1,4 +1,5 @@ [ '@bower' => '@vendor/bower-asset', diff --git a/common/config/params.php b/common/config/params.php index 9361512cfa..17be120570 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -1,4 +1,5 @@ 'admin@example.com', 'supportEmail' => 'support@example.com', diff --git a/common/config/test.php b/common/config/test.php index c50955f732..f5b6c58991 100644 --- a/common/config/test.php +++ b/common/config/test.php @@ -1,4 +1,5 @@ 'app-common-tests', 'basePath' => dirname(__DIR__), diff --git a/common/models/LoginForm.php b/common/models/LoginForm.php index 1f937a8c5c..1f1cb6f717 100644 --- a/common/models/LoginForm.php +++ b/common/models/LoginForm.php @@ -59,7 +59,7 @@ public function login() if ($this->validate()) { return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); } - + return false; } diff --git a/common/models/User.php b/common/models/User.php index 53b6e1a34a..b096b61188 100644 --- a/common/models/User.php +++ b/common/models/User.php @@ -11,23 +11,23 @@ /** * User model * - * @property integer $id + * @property int $id * @property string $username * @property string $password_hash * @property string $password_reset_token * @property string $verification_token * @property string $email * @property string $auth_key - * @property integer $status - * @property integer $created_at - * @property integer $updated_at + * @property int $status + * @property int $created_at + * @property int $updated_at * @property string $password write-only password */ class User extends ActiveRecord implements IdentityInterface { - const STATUS_DELETED = 0; - const STATUS_INACTIVE = 9; - const STATUS_ACTIVE = 10; + public const STATUS_DELETED = 0; + public const STATUS_INACTIVE = 9; + public const STATUS_ACTIVE = 10; /** @@ -110,7 +110,8 @@ public static function findByPasswordResetToken($token) * @param string $token verify email token * @return static|null */ - public static function findByVerificationToken($token) { + public static function findByVerificationToken($token) + { return static::findOne([ 'verification_token' => $token, 'status' => self::STATUS_INACTIVE diff --git a/common/tests/_support/UnitTester.php b/common/tests/_support/UnitTester.php index a0cc7a7bba..650790a9ae 100644 --- a/common/tests/_support/UnitTester.php +++ b/common/tests/_support/UnitTester.php @@ -20,7 +20,7 @@ class UnitTester extends \Codeception\Actor { use _generated\UnitTesterActions; - /** - * Define custom actions here - */ + /** + * Define custom actions here + */ } diff --git a/common/tests/unit/models/LoginFormTest.php b/common/tests/unit/models/LoginFormTest.php index 4cf136661b..1feaf6a285 100644 --- a/common/tests/unit/models/LoginFormTest.php +++ b/common/tests/unit/models/LoginFormTest.php @@ -49,7 +49,7 @@ public function testLoginWrongPassword() ]); verify($model->login())->false(); - verify( $model->errors)->arrayHasKey('password'); + verify($model->errors)->arrayHasKey('password'); verify(Yii::$app->user->isGuest)->true(); } diff --git a/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php b/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php index 4a20dc719f..08e831aa11 100644 --- a/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php +++ b/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php @@ -1,6 +1,6 @@ 'admin@example.com', ]; diff --git a/frontend/config/test.php b/frontend/config/test.php index 55d820c350..c0da46d09b 100644 --- a/frontend/config/test.php +++ b/frontend/config/test.php @@ -1,4 +1,5 @@ 'app-frontend-tests', 'components' => [ diff --git a/frontend/models/PasswordResetRequestForm.php b/frontend/models/PasswordResetRequestForm.php index db963e3567..4cdc0e1306 100644 --- a/frontend/models/PasswordResetRequestForm.php +++ b/frontend/models/PasswordResetRequestForm.php @@ -47,7 +47,7 @@ public function sendEmail() if (!$user) { return false; } - + if (!User::isPasswordResetTokenValid($user->password_reset_token)) { $user->generatePasswordResetToken(); if (!$user->save()) { diff --git a/frontend/models/SignupForm.php b/frontend/models/SignupForm.php index e42a8cab15..561a2e75db 100644 --- a/frontend/models/SignupForm.php +++ b/frontend/models/SignupForm.php @@ -48,7 +48,7 @@ public function signup() if (!$this->validate()) { return null; } - + $user = new User(); $user->username = $this->username; $user->email = $this->email; diff --git a/frontend/tests/_support/UnitTester.php b/frontend/tests/_support/UnitTester.php index 91557de371..42fd2505e8 100644 --- a/frontend/tests/_support/UnitTester.php +++ b/frontend/tests/_support/UnitTester.php @@ -20,7 +20,7 @@ class UnitTester extends \Codeception\Actor { use _generated\UnitTesterActions; - /** - * Define custom actions here - */ + /** + * Define custom actions here + */ } diff --git a/frontend/tests/acceptance/_bootstrap.php b/frontend/tests/acceptance/_bootstrap.php index 47716f00f1..19b97ec0a7 100644 --- a/frontend/tests/acceptance/_bootstrap.php +++ b/frontend/tests/acceptance/_bootstrap.php @@ -1,4 +1,5 @@ click('About'); $I->see('This is the About page.'); } -} \ No newline at end of file +} diff --git a/frontend/tests/functional/SignupCest.php b/frontend/tests/functional/SignupCest.php index b83b795e2c..10cd523cc0 100644 --- a/frontend/tests/functional/SignupCest.php +++ b/frontend/tests/functional/SignupCest.php @@ -22,17 +22,17 @@ public function signupWithEmptyFields(FunctionalTester $I) $I->seeValidationError('Username cannot be blank.'); $I->seeValidationError('Email cannot be blank.'); $I->seeValidationError('Password cannot be blank.'); - } public function signupWithWrongEmail(FunctionalTester $I) { $I->submitForm( - $this->formId, [ - 'SignupForm[username]' => 'tester', - 'SignupForm[email]' => 'ttttt', - 'SignupForm[password]' => 'tester_password', - ] + $this->formId, + [ + 'SignupForm[username]' => 'tester', + 'SignupForm[email]' => 'ttttt', + 'SignupForm[password]' => 'tester_password', + ] ); $I->dontSee('Username cannot be blank.', '.invalid-feedback'); $I->dontSee('Password cannot be blank.', '.invalid-feedback'); diff --git a/frontend/tests/functional/_bootstrap.php b/frontend/tests/functional/_bootstrap.php index 30ed54b830..933ad4f3b2 100644 --- a/frontend/tests/functional/_bootstrap.php +++ b/frontend/tests/functional/_bootstrap.php @@ -1,4 +1,5 @@ tester->grabFixture('user', 0); - + $model = new PasswordResetRequestForm(); $model->email = $userFixture['email']; $user = User::findOne(['password_reset_token' => $userFixture['password_reset_token']]); diff --git a/frontend/tests/unit/models/ResendVerificationEmailFormTest.php b/frontend/tests/unit/models/ResendVerificationEmailFormTest.php index af3548a003..654ba417d4 100644 --- a/frontend/tests/unit/models/ResendVerificationEmailFormTest.php +++ b/frontend/tests/unit/models/ResendVerificationEmailFormTest.php @@ -2,7 +2,6 @@ namespace frontend\tests\unit\models; - use Codeception\Test\Unit; use common\fixtures\UserFixture; use frontend\models\ResendVerificationEmailForm; diff --git a/frontend/tests/unit/models/ResetPasswordFormTest.php b/frontend/tests/unit/models/ResetPasswordFormTest.php index 8d969a6f16..756c13a9eb 100644 --- a/frontend/tests/unit/models/ResetPasswordFormTest.php +++ b/frontend/tests/unit/models/ResetPasswordFormTest.php @@ -25,11 +25,11 @@ public function _before() public function testResetWrongToken() { - $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function() { + $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function () { new ResetPasswordForm(''); }); - $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function() { + $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function () { new ResetPasswordForm('notexistingtoken_1391882543'); }); } @@ -40,5 +40,4 @@ public function testResetCorrectToken() $form = new ResetPasswordForm($user['password_reset_token']); verify($form->resetPassword())->notEmpty(); } - } diff --git a/frontend/tests/unit/models/VerifyEmailFormTest.php b/frontend/tests/unit/models/VerifyEmailFormTest.php index e0fe2e490b..472cc805a3 100644 --- a/frontend/tests/unit/models/VerifyEmailFormTest.php +++ b/frontend/tests/unit/models/VerifyEmailFormTest.php @@ -25,18 +25,18 @@ public function _before() public function testVerifyWrongToken() { - $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function() { + $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function () { new VerifyEmailForm(''); }); - $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function() { + $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function () { new VerifyEmailForm('notexistingtoken_1391882543'); }); } public function testAlreadyActivatedToken() { - $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function() { + $this->tester->expectThrowable('\yii\base\InvalidArgumentException', function () { new VerifyEmailForm('already_used_token_1548675330'); }); } diff --git a/requirements.php b/requirements.php index 2859da7f91..919f9dcb96 100644 --- a/requirements.php +++ b/requirements.php @@ -1,4 +1,5 @@