From b0cf145c6b7b753bd2a97b53a9d0482e8068779f Mon Sep 17 00:00:00 2001 From: Antonio Ramirez Date: Thu, 15 Dec 2016 23:01:45 +0100 Subject: [PATCH] php cs fixer --- tests/_app/config/console.php | 6 +++--- tests/_app/config/db.php | 4 ++-- tests/_app/config/test.php | 8 ++++---- tests/_app/yii.php | 6 +++--- tests/_bootstrap.php | 10 +++++----- tests/_fixtures/ProfileFixture.php | 2 +- tests/_fixtures/TokenFixture.php | 2 +- tests/_fixtures/data/profile.php | 2 +- tests/_fixtures/data/token.php | 24 ++++++++++++------------ tests/_pages/AdminPage.php | 2 +- tests/_pages/CreatePage.php | 2 +- tests/_pages/LoginPage.php | 2 +- tests/_pages/RecoveryPage.php | 2 +- tests/_pages/RegistrationPage.php | 2 +- tests/_pages/ResendPage.php | 2 +- tests/_pages/SettingsPage.php | 2 +- tests/_pages/UpdatePage.php | 2 +- tests/_support/FunctionalTester.php | 7 ++++--- tests/_support/UnitTester.php | 7 ++++--- tests/functional/ConfirmationCept.php | 3 +-- tests/functional/CreateCept.php | 3 +-- tests/functional/LoginCept.php | 3 +-- tests/functional/RecoveryCept.php | 7 +++---- tests/functional/RegistrationCest.php | 11 +++++++---- tests/functional/ResendCept.php | 3 +-- tests/functional/SettingsCept.php | 11 +++++------ tests/functional/UpdateCept.php | 3 +-- 27 files changed, 68 insertions(+), 70 deletions(-) diff --git a/tests/_app/config/console.php b/tests/_app/config/console.php index 11ddc2b..c88ff61 100644 --- a/tests/_app/config/console.php +++ b/tests/_app/config/console.php @@ -4,12 +4,12 @@ return [ 'id' => 'yii2-test-console', 'basePath' => dirname(__DIR__), 'aliases' => [ - '@Da/User' => dirname(dirname(dirname(__DIR__))) . '/lib/User', + '@Da/User' => dirname(dirname(dirname(__DIR__))).'/lib/User', '@tests' => dirname(dirname(__DIR__)), ], 'components' => [ - 'log' => null, + 'log' => null, 'cache' => null, - 'db' => require __DIR__ . '/db.php', + 'db' => require __DIR__.'/db.php', ], ]; diff --git a/tests/_app/config/db.php b/tests/_app/config/db.php index 07384e6..1bf7380 100644 --- a/tests/_app/config/db.php +++ b/tests/_app/config/db.php @@ -8,8 +8,8 @@ $db = [ 'charset' => 'utf8', ]; -if (file_exists(__DIR__ . '/db.local.php')) { - $db = array_merge($db, require(__DIR__ . '/db.local.php')); +if (file_exists(__DIR__.'/db.local.php')) { + $db = array_merge($db, require(__DIR__.'/db.local.php')); } return $db; diff --git a/tests/_app/config/test.php b/tests/_app/config/test.php index 30b589a..611b226 100644 --- a/tests/_app/config/test.php +++ b/tests/_app/config/test.php @@ -5,10 +5,10 @@ return [ 'basePath' => dirname(__DIR__), 'language' => 'en-US', 'aliases' => [ - '@Da/User' => dirname(dirname(dirname(__DIR__))) . '/lib/User', + '@Da/User' => dirname(dirname(dirname(__DIR__))).'/lib/User', '@tests' => dirname(dirname(__DIR__)), '@vendor' => VENDOR_DIR, - '@bower' => VENDOR_DIR . '/bower-asset', + '@bower' => VENDOR_DIR.'/bower-asset', ], 'bootstrap' => ['Da\User\Bootstrap'], 'modules' => [ @@ -19,9 +19,9 @@ return [ ], 'components' => [ 'assetManager' => [ - 'basePath' => __DIR__ . '/../assets' + 'basePath' => __DIR__.'/../assets', ], - 'db' => require __DIR__ . '/db.php', + 'db' => require __DIR__.'/db.php', 'mailer' => [ 'useFileTransport' => true, ], diff --git a/tests/_app/yii.php b/tests/_app/yii.php index e4e322d..15d387f 100644 --- a/tests/_app/yii.php +++ b/tests/_app/yii.php @@ -1,12 +1,12 @@ #!/usr/bin/env php run(); -exit($exitCode); \ No newline at end of file +exit($exitCode); diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php index 033599b..80678cf 100644 --- a/tests/_bootstrap.php +++ b/tests/_bootstrap.php @@ -4,17 +4,17 @@ define('YII_ENV', 'test'); defined('YII_DEBUG') or define('YII_DEBUG', true); // Search for autoload, since performance is irrelevant and usability isn't! -$dir = __DIR__ . '/../'; -while (!file_exists($dir . '/vendor/autoload.php')) { +$dir = __DIR__.'/../'; +while (!file_exists($dir.'/vendor/autoload.php')) { if ($dir == dirname($dir)) { throw new \Exception('Failed to locate autoload.php'); } $dir = dirname($dir); } -$vendor = $dir . '/vendor'; +$vendor = $dir.'/vendor'; define('VENDOR_DIR', $vendor); -require_once $vendor . '/autoload.php'; -require $vendor . '/yiisoft/yii2/Yii.php'; +require_once $vendor.'/autoload.php'; +require $vendor.'/yiisoft/yii2/Yii.php'; diff --git a/tests/_fixtures/ProfileFixture.php b/tests/_fixtures/ProfileFixture.php index ac9898e..241c530 100644 --- a/tests/_fixtures/ProfileFixture.php +++ b/tests/_fixtures/ProfileFixture.php @@ -9,6 +9,6 @@ class ProfileFixture extends ActiveFixture public $modelClass = 'Da\User\Model\Profile'; public $depends = [ - 'tests\_fixtures\UserFixture' + 'tests\_fixtures\UserFixture', ]; } diff --git a/tests/_fixtures/TokenFixture.php b/tests/_fixtures/TokenFixture.php index 184fdc1..6aecd62 100644 --- a/tests/_fixtures/TokenFixture.php +++ b/tests/_fixtures/TokenFixture.php @@ -9,6 +9,6 @@ class TokenFixture extends ActiveFixture public $modelClass = 'Da\User\Model\Token'; public $depends = [ - 'tests\_fixtures\UserFixture' + 'tests\_fixtures\UserFixture', ]; } diff --git a/tests/_fixtures/data/profile.php b/tests/_fixtures/data/profile.php index d6fc7ae..7b2a40f 100644 --- a/tests/_fixtures/data/profile.php +++ b/tests/_fixtures/data/profile.php @@ -5,6 +5,6 @@ $time = time(); return [ 'user' => [ 'user_id' => 1, - 'name' => 'John Doe', + 'name' => 'John Doe', ], ]; diff --git a/tests/_fixtures/data/token.php b/tests/_fixtures/data/token.php index 0842bf7..fdbf3b5 100644 --- a/tests/_fixtures/data/token.php +++ b/tests/_fixtures/data/token.php @@ -6,27 +6,27 @@ $time = time(); return [ 'confirmation' => [ - 'user_id' => 2, - 'code' => 'NO2aCmBIjFQX624xmAc3VBu7Th3NJoa6', - 'type' => Token::TYPE_CONFIRMATION, + 'user_id' => 2, + 'code' => 'NO2aCmBIjFQX624xmAc3VBu7Th3NJoa6', + 'type' => Token::TYPE_CONFIRMATION, 'created_at' => $time, ], 'expired_confirmation' => [ - 'user_id' => 3, - 'code' => 'qxYa315rqRgCOjYGk82GFHMEAV3T82AX', - 'type' => Token::TYPE_CONFIRMATION, + 'user_id' => 3, + 'code' => 'qxYa315rqRgCOjYGk82GFHMEAV3T82AX', + 'type' => Token::TYPE_CONFIRMATION, 'created_at' => $time - 86401, ], 'expired_recovery' => [ - 'user_id' => 5, - 'code' => 'a5839d0e73b9c525942c2f59e88c1aaf', - 'type' => Token::TYPE_RECOVERY, + 'user_id' => 5, + 'code' => 'a5839d0e73b9c525942c2f59e88c1aaf', + 'type' => Token::TYPE_RECOVERY, 'created_at' => $time - 21601, ], 'recovery' => [ - 'user_id' => 6, - 'code' => '6f5d0dad53ef73e6ba6f01a441c0e602', - 'type' => Token::TYPE_RECOVERY, + 'user_id' => 6, + 'code' => '6f5d0dad53ef73e6ba6f01a441c0e602', + 'type' => Token::TYPE_RECOVERY, 'created_at' => $time, ], ]; diff --git a/tests/_pages/AdminPage.php b/tests/_pages/AdminPage.php index e6affae..03953e3 100644 --- a/tests/_pages/AdminPage.php +++ b/tests/_pages/AdminPage.php @@ -11,6 +11,6 @@ use yii\codeception\BasePage; */ class AdminPage extends BasePage { - /** @inheritdoc */ + /** {@inheritdoc} */ public $route = '/user/admin/index'; } diff --git a/tests/_pages/CreatePage.php b/tests/_pages/CreatePage.php index 503b061..8bfff65 100644 --- a/tests/_pages/CreatePage.php +++ b/tests/_pages/CreatePage.php @@ -11,7 +11,7 @@ use yii\codeception\BasePage; */ class CreatePage extends BasePage { - /** @inheritdoc */ + /** {@inheritdoc} */ public $route = '/user/admin/create'; /** diff --git a/tests/_pages/LoginPage.php b/tests/_pages/LoginPage.php index 79ad32c..6175bd3 100644 --- a/tests/_pages/LoginPage.php +++ b/tests/_pages/LoginPage.php @@ -11,7 +11,7 @@ use yii\codeception\BasePage; */ class LoginPage extends BasePage { - /** @inheritdoc */ + /** {@inheritdoc} */ public $route = '/user/security/login'; /** diff --git a/tests/_pages/RecoveryPage.php b/tests/_pages/RecoveryPage.php index 82306e5..b3caf8e 100644 --- a/tests/_pages/RecoveryPage.php +++ b/tests/_pages/RecoveryPage.php @@ -11,7 +11,7 @@ use yii\codeception\BasePage; */ class RecoveryPage extends BasePage { - /** @inheritdoc */ + /** {@inheritdoc} */ public $route = '/user/recovery/request'; /** diff --git a/tests/_pages/RegistrationPage.php b/tests/_pages/RegistrationPage.php index 3edfd20..17d3670 100644 --- a/tests/_pages/RegistrationPage.php +++ b/tests/_pages/RegistrationPage.php @@ -11,7 +11,7 @@ use yii\codeception\BasePage; */ class RegistrationPage extends BasePage { - /** @inheritdoc */ + /** {@inheritdoc} */ public $route = '/user/registration/register'; /** diff --git a/tests/_pages/ResendPage.php b/tests/_pages/ResendPage.php index dacec11..c580ec5 100644 --- a/tests/_pages/ResendPage.php +++ b/tests/_pages/ResendPage.php @@ -11,7 +11,7 @@ use yii\codeception\BasePage; */ class ResendPage extends BasePage { - /** @inheritdoc */ + /** {@inheritdoc} */ public $route = '/user/registration/resend'; /** diff --git a/tests/_pages/SettingsPage.php b/tests/_pages/SettingsPage.php index 053fd98..bad428c 100644 --- a/tests/_pages/SettingsPage.php +++ b/tests/_pages/SettingsPage.php @@ -11,7 +11,7 @@ use yii\codeception\BasePage; */ class SettingsPage extends BasePage { - /** @inheritdoc */ + /** {@inheritdoc} */ public $route = '/user/settings/account'; /** diff --git a/tests/_pages/UpdatePage.php b/tests/_pages/UpdatePage.php index 0819f82..c438eb0 100644 --- a/tests/_pages/UpdatePage.php +++ b/tests/_pages/UpdatePage.php @@ -11,7 +11,7 @@ use yii\codeception\BasePage; */ class UpdatePage extends BasePage { - /** @inheritdoc */ + /** {@inheritdoc} */ public $route = '/user/admin/update'; /** diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php index 7e888f8..dd136f3 100644 --- a/tests/_support/FunctionalTester.php +++ b/tests/_support/FunctionalTester.php @@ -2,7 +2,8 @@ /** - * Inherited Methods + * Inherited Methods. + * * @method void wantToTest($text) * @method void wantTo($text) * @method void execute($callable) @@ -15,12 +16,12 @@ * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) * * @SuppressWarnings(PHPMD) -*/ + */ class FunctionalTester extends \Codeception\Actor { use _generated\FunctionalTesterActions; - /** + /* * Define custom actions here */ } diff --git a/tests/_support/UnitTester.php b/tests/_support/UnitTester.php index 2835357..e385e7c 100644 --- a/tests/_support/UnitTester.php +++ b/tests/_support/UnitTester.php @@ -2,7 +2,8 @@ /** - * Inherited Methods + * Inherited Methods. + * * @method void wantToTest($text) * @method void wantTo($text) * @method void execute($callable) @@ -15,12 +16,12 @@ * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) * * @SuppressWarnings(PHPMD) -*/ + */ class UnitTester extends \Codeception\Actor { use _generated\UnitTesterActions; - /** + /* * Define custom actions here */ } diff --git a/tests/functional/ConfirmationCept.php b/tests/functional/ConfirmationCept.php index eac0983..ce85880 100644 --- a/tests/functional/ConfirmationCept.php +++ b/tests/functional/ConfirmationCept.php @@ -1,9 +1,8 @@ grabLastSentEmail(); //$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]); //$I->amOnPage(Url::toRoute(['/user/recovery/reset', 'id' => $user->id, 'code' => $token->code])); //$I->see('Recovery link is invalid or expired. Please try requesting a new one.'); -// + //$I->amGoingTo('reset password'); //$user = $I->grabFixture('user', 'user_with_recovery_token'); //$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]); @@ -48,7 +47,7 @@ $message = $I->grabLastSentEmail(); //$I->fillField('#recoveryform-password', 'newpass'); //$I->click('Finish'); //$I->see('Your password has been changed successfully.'); -// + //$page = LoginPage::openBy($I); //$page->login($user->email, 'qwerty'); //$I->see('Invalid login or password'); diff --git a/tests/functional/RegistrationCest.php b/tests/functional/RegistrationCest.php index dcdfb16..4ea29e4 100644 --- a/tests/functional/RegistrationCest.php +++ b/tests/functional/RegistrationCest.php @@ -19,19 +19,20 @@ class RegistrationCest public function _after(FunctionalTester $I) { \Yii::$container->set(Module::className(), [ - 'enableEmailConfirmation' => true, + 'enableEmailConfirmation' => true, 'generatePasswords' => false, ]); } /** * Tests registration with email, username and password without any confirmation. + * * @param FunctionalTester $I */ public function testRegistration(FunctionalTester $I) { \Yii::$container->set(Module::className(), [ - 'enableEmailConfirmation' => false, + 'enableEmailConfirmation' => false, 'generatePasswords' => false, ]); @@ -62,6 +63,7 @@ class RegistrationCest /** * Tests registration when confirmation message is sent. + * * @param FunctionalTester $I */ public function testRegistrationWithConfirmation(FunctionalTester $I) @@ -72,7 +74,7 @@ class RegistrationCest $page = RegistrationPage::openBy($I); $page->register('tester@example.com', 'tester', 'tester'); $I->see('Your account has been created and a message with further instructions has been sent to your email'); - $user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']); + $user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']); $token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_CONFIRMATION]); /** @var yii\swiftmailer\Message $message */ $message = $I->grabLastSentEmail(); @@ -83,12 +85,13 @@ class RegistrationCest /** * Tests registration when password is generated automatically and sent to user. + * * @param FunctionalTester $I */ public function testRegistrationWithoutPassword(FunctionalTester $I) { \Yii::$container->set(Module::className(), [ - 'enableEmailConfirmation' => false, + 'enableEmailConfirmation' => false, 'generatePasswords' => true, ]); $page = RegistrationPage::openBy($I); diff --git a/tests/functional/ResendCept.php b/tests/functional/ResendCept.php index 090cde3..1eec368 100644 --- a/tests/functional/ResendCept.php +++ b/tests/functional/ResendCept.php @@ -1,9 +1,8 @@ amGoingTo('check that email is changing properly'); $page->update('new_user@example.com', $user->username, 'qwerty'); $I->seeRecord(User::className(), ['email' => $user->email, 'unconfirmed_email' => 'new_user@example.com']); $I->see('A confirmation message has been sent to your new email address'); -$user = $I->grabRecord(User::className(), ['id' => $user->id]); +$user = $I->grabRecord(User::className(), ['id' => $user->id]); $token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_CONFIRM_NEW_EMAIL]); /** @var yii\swiftmailer\Message $message */ $message = $I->grabLastSentEmail(); @@ -62,14 +61,14 @@ $page = SettingsPage::openBy($I); $page->update('user@example.com', $user->username, 'qwerty'); $I->see('A confirmation message has been sent to your new email address'); $I->seeRecord(User::className(), [ - 'id' => 1, + 'id' => 1, 'email' => 'new_user@example.com', 'unconfirmed_email' => 'user@example.com', ]); $page->update('new_user@example.com', $user->username, 'qwerty'); $I->see('Your account details have been updated'); $I->seeRecord(User::className(), [ - 'id' => 1, + 'id' => 1, 'email' => 'new_user@example.com', 'unconfirmed_email' => null, ]); @@ -78,7 +77,7 @@ $page->update('new_user@example.com', 'nickname', 'qwerty', '123654'); $I->see('Your account details have been updated'); $I->seeRecord(User::className(), [ 'username' => 'nickname', - 'email' => 'new_user@example.com', + 'email' => 'new_user@example.com', ]); Yii::$app->user->logout(); diff --git a/tests/functional/UpdateCept.php b/tests/functional/UpdateCept.php index 086c78e..a383a32 100644 --- a/tests/functional/UpdateCept.php +++ b/tests/functional/UpdateCept.php @@ -1,9 +1,8 @@