|
|
@@ -19,8 +19,8 @@ class LoginFormTest extends TestCase
|
|
|
$model->password = 'some_password';
|
|
|
|
|
|
$this->specify('user should not be able to login, when there is no identity' , function () use ($model) {
|
|
|
- $this->assertFalse($model->login());
|
|
|
- $this->assertTrue(Yii::$app->user->isGuest,'user should not be logged in');
|
|
|
+ expect('model should not login user', $model->login())->false();
|
|
|
+ expect('user should not be logged in', Yii::$app->user->isGuest)->true();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -32,9 +32,9 @@ class LoginFormTest extends TestCase
|
|
|
$model->password = 'wrong-password';
|
|
|
|
|
|
$this->specify('user should not be able to login with wrong password', function () use ($model) {
|
|
|
- $this->assertFalse($model->login());
|
|
|
- $this->assertArrayHasKey('password', $model->errors);
|
|
|
- $this->assertTrue(Yii::$app->user->isGuest, 'user should not be logged in');
|
|
|
+ expect('model should not login user', $model->login())->false();
|
|
|
+ expect('error message should be set', $model->errors)->hasKey('password');
|
|
|
+ expect('user should not be logged in', Yii::$app->user->isGuest)->true();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -46,9 +46,9 @@ class LoginFormTest extends TestCase
|
|
|
$model->password = 'demo';
|
|
|
|
|
|
$this->specify('user should be able to login with correct credentials', function() use ($model) {
|
|
|
- $this->assertTrue($model->login());
|
|
|
- $this->assertArrayNotHasKey('password', $model->errors);
|
|
|
- $this->assertFalse(Yii::$app->user->isGuest,'user should be logged in');
|
|
|
+ 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();
|
|
|
});
|
|
|
}
|
|
|
|