mirror of
https://github.com/yiisoft/yii2-app-advanced.git
synced 2026-02-20 01:21:23 +01:00
Fix codestyle (#572)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$params = array_merge(
|
||||
require __DIR__ . '/../../common/config/params.php',
|
||||
require __DIR__ . '/../../common/config/params-local.php',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'adminEmail' => 'admin@example.com',
|
||||
];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'id' => 'app-backend-tests',
|
||||
'components' => [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'username' => 'erau',
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace backend\tests;
|
||||
class FunctionalTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\FunctionalTesterActions;
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace backend\tests;
|
||||
class UnitTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\UnitTesterActions;
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class LoginCest
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Here you can initialize variables via \Codeception\Util\Fixtures class
|
||||
* to store data in global array and use it in Cests.
|
||||
@@ -13,4 +14,4 @@
|
||||
* ```php
|
||||
* \Codeception\Util\Fixtures::get('user1');
|
||||
* ```
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Here you can initialize variables via \Codeception\Util\Fixtures class
|
||||
* to store data in global array and use it in Tests.
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Yii {
|
||||
class Yii
|
||||
{
|
||||
/**
|
||||
* @var \yii\web\Application|\yii\console\Application|__Application
|
||||
*/
|
||||
@@ -19,15 +20,16 @@ class Yii {
|
||||
}
|
||||
|
||||
/**
|
||||
* @property yii\rbac\DbManager $authManager
|
||||
* @property yii\rbac\DbManager $authManager
|
||||
* @property \yii\web\User|__WebUser $user
|
||||
*
|
||||
*/
|
||||
class __Application {
|
||||
class __Application
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @property app\models\User $identity
|
||||
*/
|
||||
class __WebUser {
|
||||
class __WebUser
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
Yii::setAlias('@common', dirname(__DIR__));
|
||||
Yii::setAlias('@frontend', dirname(dirname(__DIR__)) . '/frontend');
|
||||
Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend');
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'aliases' => [
|
||||
'@bower' => '@vendor/bower-asset',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'adminEmail' => 'admin@example.com',
|
||||
'supportEmail' => 'support@example.com',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'id' => 'app-common-tests',
|
||||
'basePath' => dirname(__DIR__),
|
||||
|
||||
@@ -59,7 +59,7 @@ class LoginForm extends Model
|
||||
if ($this->validate()) {
|
||||
return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,23 +11,23 @@ use yii\web\IdentityInterface;
|
||||
/**
|
||||
* 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 @@ class User extends ActiveRecord implements IdentityInterface
|
||||
* @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
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace common\tests;
|
||||
class UnitTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\UnitTesterActions;
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class LoginFormTest extends \Codeception\Test\Unit
|
||||
]);
|
||||
|
||||
verify($model->login())->false();
|
||||
verify( $model->errors)->arrayHasKey('password');
|
||||
verify($model->errors)->arrayHasKey('password');
|
||||
verify(Yii::$app->user->isGuest)->true();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use \yii\db\Migration;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m190124_110200_add_verification_token_column_to_user_table extends Migration
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The manifest of files that are local to specific environment.
|
||||
* This file returns a list of environments that the application
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$params = array_merge(
|
||||
require __DIR__ . '/../../common/config/params.php',
|
||||
require __DIR__ . '/../../common/config/params-local.php',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'adminEmail' => 'admin@example.com',
|
||||
];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'id' => 'app-frontend-tests',
|
||||
'components' => [
|
||||
|
||||
@@ -47,7 +47,7 @@ class PasswordResetRequestForm extends Model
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
|
||||
$user->generatePasswordResetToken();
|
||||
if (!$user->save()) {
|
||||
|
||||
@@ -48,7 +48,7 @@ class SignupForm extends Model
|
||||
if (!$this->validate()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$user = new User();
|
||||
$user->username = $this->username;
|
||||
$user->email = $this->email;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace frontend\tests;
|
||||
class UnitTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\UnitTesterActions;
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Here you can initialize variables via \Codeception\Util\Fixtures class
|
||||
* to store data in global array and use it in Cepts.
|
||||
@@ -13,4 +14,4 @@
|
||||
* ```php
|
||||
* \Codeception\Util\Fixtures::get('user1');
|
||||
* ```
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -14,4 +14,4 @@ class HomeCest
|
||||
$I->click('About');
|
||||
$I->see('This is the About page.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,17 +22,17 @@ class SignupCest
|
||||
$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');
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Here you can initialize variables via \Codeception\Util\Fixtures class
|
||||
* to store data in global array and use it in Cests.
|
||||
@@ -13,4 +14,4 @@
|
||||
* ```php
|
||||
* \Codeception\Util\Fixtures::get('user1');
|
||||
* ```
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Here you can initialize variables via \Codeception\Util\Fixtures class
|
||||
* to store data in global array and use it in Tests.
|
||||
|
||||
@@ -43,7 +43,7 @@ class PasswordResetRequestFormTest extends \Codeception\Test\Unit
|
||||
public function testSendEmailSuccessfully()
|
||||
{
|
||||
$userFixture = $this->tester->grabFixture('user', 0);
|
||||
|
||||
|
||||
$model = new PasswordResetRequestForm();
|
||||
$model->email = $userFixture['email'];
|
||||
$user = User::findOne(['password_reset_token' => $userFixture['password_reset_token']]);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace frontend\tests\unit\models;
|
||||
|
||||
|
||||
use Codeception\Test\Unit;
|
||||
use common\fixtures\UserFixture;
|
||||
use frontend\models\ResendVerificationEmailForm;
|
||||
|
||||
@@ -25,11 +25,11 @@ class ResetPasswordFormTest extends \Codeception\Test\Unit
|
||||
|
||||
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 @@ class ResetPasswordFormTest extends \Codeception\Test\Unit
|
||||
$form = new ResetPasswordForm($user['password_reset_token']);
|
||||
verify($form->resetPassword())->notEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,18 +25,18 @@ class VerifyEmailFormTest extends \Codeception\Test\Unit
|
||||
|
||||
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');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Application requirement checker script.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user