Covered everything in the user controller except configuration controlled statements.

This commit is contained in:
James Cole
2014-12-31 00:57:12 +01:00
parent 578298580e
commit 7e96054dc2
9 changed files with 74 additions and 36 deletions

View File

@@ -53,18 +53,11 @@ class UserControllerCest
*/
public function logout(FunctionalTester $I)
{
$I->amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']);
$I->wantTo('logout');
#$I->amOnPage('/logout');
#$I->am
}
/**
* @param FunctionalTester $I
*/
public function postLogin(FunctionalTester $I)
{
$I->wantTo('post login');
$I->amOnRoute('login');
$I->amOnPage('/');
$I->click('Logout');
$I->see('Firefly III — Sign In');
}
/**
@@ -72,14 +65,23 @@ class UserControllerCest
*/
public function postRegister(FunctionalTester $I)
{
// @codingStandardsIgnoreStart
$I->wantTo('post-register a new account');
$I->amOnPage('/register');
$token = $I->grabValueFrom('input[name=_token]');
$I->submitForm('#register', ['email' => 'noreply@gmail.com', '_token' => $token]);
$I->submitForm('#register', ['email' => 'noreply@gmail.com']);
$I->see('Password sent!');
$I->seeRecord('users', ['email' => 'noreply@gmail.com']);
// @codingStandardsIgnoreEnd
}
/**
* @param FunctionalTester $I
*/
public function postRegisterFail(FunctionalTester $I)
{
$I->wantTo('post-register a new account and fail');
$I->amOnPage('/register');
$I->submitForm('#register', ['email' => 'XXxxxxx']);
$I->see('Input invalid, please try again: The email must be a valid email address.');
$I->dontseeRecord('users', ['email' => 'XXxxxxx']);
}
/**
@@ -89,6 +91,19 @@ class UserControllerCest
{
$I->wantTo('get a password reminder');
$I->amOnRoute('remindme');
$I->submitForm('#remindme', ['email' => 'functional@example.com']);
$I->see('You\'re about to get an e-mail.');
}
/**
* @param FunctionalTester $I
*/
public function postRemindmeFail(FunctionalTester $I)
{
$I->wantTo('get a password reminder and fail');
$I->amOnRoute('remindme');
$I->submitForm('#remindme', ['email' => 'abcdee']);
$I->see('No good!');
}
/**
@@ -109,6 +124,17 @@ class UserControllerCest
{
$I->wantTo('reminded of my password');
$I->amOnRoute('remindme');
$I->see('Firefly III — Reset your password');
}
/**
* @param FunctionalTester $I
*/
public function resetFail(FunctionalTester $I)
{
$I->wantTo('reset my password and fail');
$I->amOnPage('/reset/123');
$I->see('Yo no hablo reset code!');
}
/**
@@ -117,7 +143,8 @@ class UserControllerCest
public function reset(FunctionalTester $I)
{
$I->wantTo('reset my password');
$I->amOnRoute('reset');
$I->amOnPage('/reset/okokokokokokokokokokokokokokokok');
$I->see('You\'re about to get an e-mail.');
}
}