Skip to content

Commit e51bf13

Browse files
committed
Merge pull request yiisoft#2620 from AlexGx/apps-codestyle-fix
apps code style fixes
2 parents 3777ec2 + 9c4c8ff commit e51bf13

File tree

10 files changed

+15
-25
lines changed

10 files changed

+15
-25
lines changed

apps/advanced/common/tests/_helpers/FixtureHelper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class FixtureHelper extends Module
3232
* to use in acceptance and functional tests.
3333
* @param array $settings
3434
*/
35-
public function _beforeSuite($settings = array())
35+
public function _beforeSuite($settings = [])
3636
{
3737
$this->loadFixtures();
3838
}
@@ -54,5 +54,4 @@ protected function fixtures()
5454
],
5555
];
5656
}
57-
5857
}

apps/advanced/common/tests/_pages/LoginPage.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ public function login($username, $password)
1818
$this->guy->fillField('input[name="LoginForm[password]"]', $password);
1919
$this->guy->click('login-button');
2020
}
21-
2221
}

apps/advanced/common/tests/unit/models/LoginFormTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testLoginNoUser()
2525
$model->username = 'some_username';
2626
$model->password = 'some_password';
2727

28-
$this->specify('user should not be able to login, when there is no identity' , function () use ($model) {
28+
$this->specify('user should not be able to login, when there is no identity', function () use ($model) {
2929
expect('model should not login user', $model->login())->false();
3030
expect('user should not be logged in', Yii::$app->user->isGuest)->true();
3131
});
@@ -52,7 +52,7 @@ public function testLoginCorrect()
5252
$model->username = 'demo';
5353
$model->password = 'demo';
5454

55-
$this->specify('user should be able to login with correct credentials', function() use ($model) {
55+
$this->specify('user should be able to login with correct credentials', function () use ($model) {
5656
expect('model should login user', $model->login())->true();
5757
expect('error message should not be set', $model->errors)->hasntKey('password');
5858
expect('user should be logged in', Yii::$app->user->isGuest)->false();
@@ -61,9 +61,8 @@ public function testLoginCorrect()
6161

6262
private function mockUser($user)
6363
{
64-
$loginForm = $this->getMock('common\models\LoginForm',['getUser']);
64+
$loginForm = $this->getMock('common\models\LoginForm', ['getUser']);
6565
$loginForm->expects($this->any())->method('getUser')->will($this->returnValue($user));
6666
return $loginForm;
6767
}
68-
6968
}

apps/advanced/frontend/tests/_pages/SignupPage.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ public function submit(array $signupData)
2020
}
2121
$this->guy->click('signup-button');
2222
}
23-
2423
}

apps/advanced/frontend/tests/acceptance/SignupCest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,4 @@ public function testUserSignup($I, $scenario)
7979
$I->expectTo('see that user logged in');
8080
$I->see('Logout (tester)');
8181
}
82-
8382
}

apps/advanced/frontend/tests/functional/SignupCest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,4 @@ public function testUserSignup($I, $scenario)
7979
$I->expectTo('see that user logged in');
8080
$I->see('Logout (tester)');
8181
}
82-
8382
}

apps/advanced/frontend/tests/unit/models/ContactFormTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testContact()
4242
expect('email file should exist', file_exists($this->getMessageFile()))->true();
4343
});
4444

45-
$this->specify('message should contain correct data', function () use($model) {
45+
$this->specify('message should contain correct data', function () use ($model) {
4646
$emailMessage = file_get_contents($this->getMessageFile());
4747

4848
expect('email should contain user name', $emailMessage)->contains($model->name);
@@ -56,5 +56,4 @@ private function getMessageFile()
5656
{
5757
return Yii::getAlias(Yii::$app->mail->fileTransportPath) . '/testing_message.eml';
5858
}
59-
6059
}

apps/advanced/frontend/tests/unit/models/PasswordResetRequestFormTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ protected function tearDown()
2828

2929
public function testSendEmailWrongUser()
3030
{
31-
$this->specify('no user with such email, message should not be send', function() {
31+
$this->specify('no user with such email, message should not be send', function () {
3232
$model = new PasswordResetRequestForm();
3333
$model->email = '[email protected]';
3434

3535
expect('email not send', $model->sendEmail())->false();
3636
});
3737

38-
$this->specify('user is not active, message should not be send', function() {
38+
$this->specify('user is not active, message should not be send', function () {
3939
$model = new PasswordResetRequestForm();
4040
$model->email = $this->user[1]['email'];
4141

@@ -52,8 +52,8 @@ public function testSendEmailCorrectUser()
5252
expect('email sent', $model->sendEmail())->true();
5353
expect('user has valid token', $user->password_reset_token)->notNull();
5454

55-
$this->specify('message has correct format', function() use ($model) {
56-
expect('message file exists', file_exists($this->getMessageFile()))->true();
55+
$this->specify('message has correct format', function () use ($model) {
56+
expect('message file exists', file_exists($this->getMessageFile()))->true();
5757

5858
$message = file_get_contents($this->getMessageFile());
5959
expect('message "from" is correct', $message)->contains(Yii::$app->params['supportEmail']);
@@ -75,5 +75,4 @@ private function getMessageFile()
7575
{
7676
return Yii::getAlias(Yii::$app->mail->fileTransportPath) . '/testing_message.eml';
7777
}
78-
7978
}

apps/advanced/frontend/tests/unit/models/ResetPasswordFormTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class ResetPasswordFormTest extends DbTestCase
1313

1414
public function testResetPassword()
1515
{
16-
$this->specify('wrong reset token', function() {
17-
$this->setExpectedException('\Exception','Wrong password reset token.');
16+
$this->specify('wrong reset token', function () {
17+
$this->setExpectedException('\Exception', 'Wrong password reset token.');
1818
new ResetPasswordForm('notexistingtoken_1391882543');
1919
});
2020

21-
$this->specify('not correct token', function() {
22-
$this->setExpectedException('yii\base\InvalidParamException','Password reset token cannot be blank.');
21+
$this->specify('not correct token', function () {
22+
$this->setExpectedException('yii\base\InvalidParamException', 'Password reset token cannot be blank.');
2323
new ResetPasswordForm('');
2424
});
2525
}
@@ -33,5 +33,4 @@ public function fixtures()
3333
],
3434
];
3535
}
36-
3736
}

apps/advanced/frontend/tests/unit/models/SignupFormTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class SignupFormTest extends DbTestCase
1212

1313
public function testCorrectSignup()
1414
{
15-
$model = $this->getMock('frontend\models\SignupForm',['validate']);
15+
$model = $this->getMock('frontend\models\SignupForm', ['validate']);
1616
$model->expects($this->once())->method('validate')->will($this->returnValue(true));
1717

1818
$model->username = 'some_username';
@@ -28,7 +28,7 @@ public function testCorrectSignup()
2828

2929
public function testNotCorrectSignup()
3030
{
31-
$model = $this->getMock('frontend\models\SignupForm',['validate']);
31+
$model = $this->getMock('frontend\models\SignupForm', ['validate']);
3232
$model->expects($this->once())->method('validate')->will($this->returnValue(false));
3333

3434
expect('user should not be created', $model->signup())->null();
@@ -43,5 +43,4 @@ public function fixtures()
4343
],
4444
];
4545
}
46-
4746
}

0 commit comments

Comments
 (0)