firefly-iii/tests/functional/UserControllerCest.php

151 lines
3.7 KiB
PHP
Raw Normal View History

2014-12-07 08:37:53 -06:00
<?php
2014-12-13 02:36:30 -06:00
/**
* Class UserControllerCest
*
* @SuppressWarnings("CamelCase")
* @SuppressWarnings("short")
*/
2014-12-07 08:37:53 -06:00
class UserControllerCest
{
/**
* @param FunctionalTester $I
*/
public function _after(FunctionalTester $I)
{
}
/**
* @param FunctionalTester $I
*/
public function _before(FunctionalTester $I)
{
}
/**
* @param FunctionalTester $I
*/
public function login(FunctionalTester $I)
{
$I->wantTo('login');
$I->amOnPage('/login');
$I->see('Sign In');
2014-12-13 02:36:30 -06:00
$I->submitForm('#login', ['email' => 'functional@example.com', 'password' => 'functional']);
2014-12-07 08:37:53 -06:00
$I->see('functional@example.com');
}
2014-12-13 02:36:30 -06:00
/**
* @param FunctionalTester $I
*/
public function loginFails(FunctionalTester $I)
{
$I->wantTo('fail the login');
$I->amOnPage('/login');
$I->see('Sign In');
$I->submitForm('#login', ['email' => 'functional@example.com', 'password' => 'wrong']);
$I->see('No good');
}
2014-12-07 08:37:53 -06:00
/**
* @param FunctionalTester $I
*/
public function logout(FunctionalTester $I)
{
$I->amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']);
2014-12-07 08:37:53 -06:00
$I->wantTo('logout');
$I->amOnPage('/');
$I->click('Logout');
$I->see('Firefly III &mdash; Sign In');
2014-12-07 08:37:53 -06:00
}
/**
* @param FunctionalTester $I
*/
public function postRegister(FunctionalTester $I)
2014-12-07 08:37:53 -06:00
{
$I->wantTo('post-register a new account');
$I->amOnPage('/register');
$I->submitForm('#register', ['email' => 'noreply@gmail.com']);
2014-12-31 00:17:33 -06:00
$I->see('You\'re about to get an e-mail. Please follow its instructions.');
$I->seeRecord('users', ['email' => 'noreply@gmail.com']);
2014-12-07 08:37:53 -06:00
}
/**
* @param FunctionalTester $I
*/
public function postRegisterFail(FunctionalTester $I)
2014-12-07 08:37:53 -06:00
{
$I->wantTo('post-register a new account and fail');
2014-12-07 08:37:53 -06:00
$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']);
2014-12-07 08:37:53 -06:00
}
/**
* @param FunctionalTester $I
*/
public function postRemindme(FunctionalTester $I)
{
$I->wantTo('get a password reminder');
2014-12-31 09:17:43 -06:00
$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');
2014-12-31 09:17:43 -06:00
$I->amOnRoute('remindMe');
$I->submitForm('#remindMe', ['email' => 'abcdee']);
$I->see('No good!');
2014-12-07 08:37:53 -06:00
}
/**
* @param FunctionalTester $I
*/
public function register(FunctionalTester $I)
{
$I->wantTo('register a new account');
$I->amOnRoute('register');
}
/**
* @param FunctionalTester $I
*/
2014-12-31 09:17:43 -06:00
public function remindMe(FunctionalTester $I)
2014-12-07 08:37:53 -06:00
{
$I->wantTo('reminded of my password');
2014-12-31 09:17:43 -06:00
$I->amOnRoute('remindMe');
$I->see('Firefly III &mdash; Reset your password');
}
/**
* @param FunctionalTester $I
*/
public function resetFail(FunctionalTester $I)
{
$I->wantTo('reset my password and fail');
$I->amOnPage('/reset/123');
2014-12-31 09:45:12 -06:00
$I->see('No reset code found!');
2014-12-07 08:37:53 -06:00
}
/**
* @param FunctionalTester $I
*/
public function reset(FunctionalTester $I)
{
$I->wantTo('reset my password');
$I->amOnPage('/reset/okokokokokokokokokokokokokokokok');
$I->see('You\'re about to get an e-mail.');
2014-12-07 08:37:53 -06:00
}
2015-01-01 23:16:49 -06:00
}