mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Tests for the profile controller
This commit is contained in:
parent
8ef659f5de
commit
18c1223c7b
@ -8,7 +8,7 @@
|
||||
Change your password
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{{Form::open(['class' => 'form-horizontal'])}}
|
||||
{{Form::open(['class' => 'form-horizontal','id' => 'change-password'])}}
|
||||
<div class="form-group">
|
||||
<label for="inputOldPassword" class="col-sm-4 control-label">Old password</label>
|
||||
<div class="col-sm-8">
|
||||
|
147
tests/functional/ProfileControllerCest.php
Normal file
147
tests/functional/ProfileControllerCest.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class ProfileControllerCest
|
||||
*/
|
||||
class ProfileControllerCest
|
||||
{
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function _after(FunctionalTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function _before(FunctionalTester $I)
|
||||
{
|
||||
$I->amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function changePassword(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('change my password.');
|
||||
$I->amOnPage('/profile/change-password');
|
||||
$I->see('thegrumpydictator@gmail.com');
|
||||
$I->see('Change your password');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function index(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see my profile options');
|
||||
$I->amOnPage('/profile');
|
||||
$I->see('thegrumpydictator@gmail.com');
|
||||
$I->see('Profile');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function postChangePassword(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('submit a new password.');
|
||||
$I->amOnPage('/profile/change-password');
|
||||
$I->see('thegrumpydictator@gmail.com');
|
||||
$I->see('Change your password');
|
||||
$I->submitForm(
|
||||
'#change-password', [
|
||||
'old' => 'james',
|
||||
'new1' => 'James',
|
||||
'new2' => 'James'
|
||||
]
|
||||
);
|
||||
$I->see('Password changed!');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function postChangePasswordInvalidCurrent(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('submit a new password and enter the wrong current password.');
|
||||
$I->amOnPage('/profile/change-password');
|
||||
$I->see('thegrumpydictator@gmail.com');
|
||||
$I->see('Change your password');
|
||||
|
||||
$I->submitForm(
|
||||
'#change-password', [
|
||||
'old' => 'Blablabla',
|
||||
'new1' => 'James',
|
||||
'new2' => 'James'
|
||||
]
|
||||
);
|
||||
$I->see('Invalid current password!');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function postChangePasswordNoNewPassword(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('submit a new password and forget to fill in a new one.');
|
||||
$I->amOnPage('/profile/change-password');
|
||||
$I->see('thegrumpydictator@gmail.com');
|
||||
$I->see('Change your password');
|
||||
|
||||
$I->submitForm(
|
||||
'#change-password', [
|
||||
'old' => 'james',
|
||||
'new1' => '',
|
||||
'new2' => ''
|
||||
]
|
||||
);
|
||||
$I->see('Do fill in a password!');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function postChangePasswordToSame(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('submit a new password but fill in my old one twice.');
|
||||
$I->amOnPage('/profile/change-password');
|
||||
$I->see('thegrumpydictator@gmail.com');
|
||||
$I->see('Change your password');
|
||||
|
||||
$I->submitForm(
|
||||
'#change-password', [
|
||||
'old' => 'james',
|
||||
'new1' => 'james',
|
||||
'new2' => 'james'
|
||||
]
|
||||
);
|
||||
$I->see('The idea is to change your password.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function postChangePasswordNoMatch(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('submit a new password but make a mistake in filling it in twice.');
|
||||
$I->amOnPage('/profile/change-password');
|
||||
$I->see('thegrumpydictator@gmail.com');
|
||||
$I->see('Change your password');
|
||||
|
||||
$I->submitForm(
|
||||
'#change-password', [
|
||||
'old' => 'james',
|
||||
'new1' => 'blabla',
|
||||
'new2' => 'bla'
|
||||
]
|
||||
);
|
||||
$I->see('New passwords do not match!');
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user