Commit e51bf131 by Carsten Brandt

Merge pull request #2620 from AlexGx/apps-codestyle-fix

apps code style fixes
parents 3777ec2b 9c4c8ffb
......@@ -32,7 +32,7 @@ class FixtureHelper extends Module
* to use in acceptance and functional tests.
* @param array $settings
*/
public function _beforeSuite($settings = array())
public function _beforeSuite($settings = [])
{
$this->loadFixtures();
}
......@@ -54,5 +54,4 @@ class FixtureHelper extends Module
],
];
}
}
......@@ -18,5 +18,4 @@ class LoginPage extends BasePage
$this->guy->fillField('input[name="LoginForm[password]"]', $password);
$this->guy->click('login-button');
}
}
......@@ -25,7 +25,7 @@ class LoginFormTest extends TestCase
$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) {
$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();
});
......@@ -52,7 +52,7 @@ class LoginFormTest extends TestCase
$model->username = 'demo';
$model->password = 'demo';
$this->specify('user should be able to login with correct credentials', function() use ($model) {
$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();
......@@ -61,9 +61,8 @@ class LoginFormTest extends TestCase
private function mockUser($user)
{
$loginForm = $this->getMock('common\models\LoginForm',['getUser']);
$loginForm = $this->getMock('common\models\LoginForm', ['getUser']);
$loginForm->expects($this->any())->method('getUser')->will($this->returnValue($user));
return $loginForm;
}
}
......@@ -20,5 +20,4 @@ class SignupPage extends BasePage
}
$this->guy->click('signup-button');
}
}
......@@ -79,5 +79,4 @@ class SignupCest
$I->expectTo('see that user logged in');
$I->see('Logout (tester)');
}
}
......@@ -79,5 +79,4 @@ class SignupCest
$I->expectTo('see that user logged in');
$I->see('Logout (tester)');
}
}
......@@ -42,7 +42,7 @@ class ContactFormTest extends TestCase
expect('email file should exist', file_exists($this->getMessageFile()))->true();
});
$this->specify('message should contain correct data', function () use($model) {
$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);
......@@ -56,5 +56,4 @@ class ContactFormTest extends TestCase
{
return Yii::getAlias(Yii::$app->mail->fileTransportPath) . '/testing_message.eml';
}
}
......@@ -28,14 +28,14 @@ class PasswordResetRequestFormTest extends DbTestCase
public function testSendEmailWrongUser()
{
$this->specify('no user with such email, message should not be send', function() {
$this->specify('no user with such email, message should not be send', function () {
$model = new PasswordResetRequestForm();
$model->email = 'not-existing-email@example.com';
expect('email not send', $model->sendEmail())->false();
});
$this->specify('user is not active, message should not be send', function() {
$this->specify('user is not active, message should not be send', function () {
$model = new PasswordResetRequestForm();
$model->email = $this->user[1]['email'];
......@@ -52,8 +52,8 @@ class PasswordResetRequestFormTest extends DbTestCase
expect('email sent', $model->sendEmail())->true();
expect('user has valid token', $user->password_reset_token)->notNull();
$this->specify('message has correct format', function() use ($model) {
expect('message file exists', file_exists($this->getMessageFile()))->true();
$this->specify('message has correct format', function () use ($model) {
expect('message file exists', file_exists($this->getMessageFile()))->true();
$message = file_get_contents($this->getMessageFile());
expect('message "from" is correct', $message)->contains(Yii::$app->params['supportEmail']);
......@@ -75,5 +75,4 @@ class PasswordResetRequestFormTest extends DbTestCase
{
return Yii::getAlias(Yii::$app->mail->fileTransportPath) . '/testing_message.eml';
}
}
......@@ -13,13 +13,13 @@ class ResetPasswordFormTest extends DbTestCase
public function testResetPassword()
{
$this->specify('wrong reset token', function() {
$this->setExpectedException('\Exception','Wrong password reset token.');
$this->specify('wrong reset token', function () {
$this->setExpectedException('\Exception', 'Wrong password reset token.');
new ResetPasswordForm('notexistingtoken_1391882543');
});
$this->specify('not correct token', function() {
$this->setExpectedException('yii\base\InvalidParamException','Password reset token cannot be blank.');
$this->specify('not correct token', function () {
$this->setExpectedException('yii\base\InvalidParamException', 'Password reset token cannot be blank.');
new ResetPasswordForm('');
});
}
......@@ -33,5 +33,4 @@ class ResetPasswordFormTest extends DbTestCase
],
];
}
}
......@@ -12,7 +12,7 @@ class SignupFormTest extends DbTestCase
public function testCorrectSignup()
{
$model = $this->getMock('frontend\models\SignupForm',['validate']);
$model = $this->getMock('frontend\models\SignupForm', ['validate']);
$model->expects($this->once())->method('validate')->will($this->returnValue(true));
$model->username = 'some_username';
......@@ -28,7 +28,7 @@ class SignupFormTest extends DbTestCase
public function testNotCorrectSignup()
{
$model = $this->getMock('frontend\models\SignupForm',['validate']);
$model = $this->getMock('frontend\models\SignupForm', ['validate']);
$model->expects($this->once())->method('validate')->will($this->returnValue(false));
expect('user should not be created', $model->signup())->null();
......@@ -43,5 +43,4 @@ class SignupFormTest extends DbTestCase
],
];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment