mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-14 02:32:04 -06:00
New tests.
This commit is contained in:
parent
8666197e05
commit
5a57398f81
@ -24,6 +24,7 @@ use Illuminate\Support\Collection;
|
||||
use Input;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Response;
|
||||
use Session;
|
||||
use Steam;
|
||||
use URL;
|
||||
@ -243,6 +244,8 @@ class PiggyBankController extends Controller
|
||||
|
||||
/**
|
||||
* @param PiggyBankRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function order(PiggyBankRepositoryInterface $repository)
|
||||
{
|
||||
@ -257,6 +260,7 @@ class PiggyBankController extends Controller
|
||||
$repository->setOrder(intval($id), ($order + 1));
|
||||
}
|
||||
}
|
||||
return Response::json(['result' => 'ok']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,7 +150,7 @@ class PreferencesController extends Controller
|
||||
|
||||
// custom fiscal year
|
||||
$customFiscalYear = intval($request->get('customFiscalYear')) === 1;
|
||||
$fiscalYearStart = date('m-d', strtotime($request->get('fiscalYearStart')));
|
||||
$fiscalYearStart = date('m-d', strtotime(strval($request->get('fiscalYearStart'))));
|
||||
Preferences::set('customFiscalYear', $customFiscalYear);
|
||||
Preferences::set('fiscalYearStart', $fiscalYearStart);
|
||||
|
||||
|
@ -83,11 +83,12 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ProfileFormRequest $request
|
||||
* @param ProfileFormRequest $request
|
||||
* @param UserRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function postChangePassword(ProfileFormRequest $request)
|
||||
public function postChangePassword(ProfileFormRequest $request, UserRepositoryInterface $repository)
|
||||
{
|
||||
// old, new1, new2
|
||||
if (!Hash::check($request->get('current_password'), auth()->user()->password)) {
|
||||
@ -103,9 +104,7 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
// update the user with the new password.
|
||||
auth()->user()->password = bcrypt($request->get('new_password'));
|
||||
auth()->user()->save();
|
||||
|
||||
$repository->changePassword(auth()->user(), $request->get('new_password'));
|
||||
Session::flash('success', strval(trans('firefly.password_changed')));
|
||||
|
||||
return redirect(route('profile.index'));
|
||||
|
@ -42,8 +42,8 @@ class PiggyBankFormRequest extends Request
|
||||
'startdate' => new Carbon,
|
||||
'account_id' => intval($this->get('account_id')),
|
||||
'targetamount' => round($this->get('targetamount'), 2),
|
||||
'targetdate' => strlen($this->get('targetdate')) > 0 ? new Carbon($this->get('targetdate')) : null,
|
||||
'note' => trim($this->get('note')),
|
||||
'targetdate' => strlen(strval($this->get('targetdate'))) > 0 ? new Carbon($this->get('targetdate')) : null,
|
||||
'note' => trim(strval($this->get('note'))),
|
||||
];
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class PiggyBankFormRequest extends Request
|
||||
'name' => $nameRule,
|
||||
'account_id' => 'required|belongsToUser:accounts',
|
||||
'targetamount' => 'required|min:0.01',
|
||||
'amount_currency_id_targetamount' => 'exists:transaction_currencies,id',
|
||||
'amount_currency_id_targetamount' => 'required|exists:transaction_currencies,id',
|
||||
'startdate' => 'date',
|
||||
'targetdate' => $targetDateRule,
|
||||
'order' => 'integer|min:1',
|
||||
|
@ -413,7 +413,22 @@ Breadcrumbs::register(
|
||||
'piggy-banks.show', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggy-banks.index');
|
||||
$breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', [$piggyBank->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'piggy-banks.add-money-mobile', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
|
||||
$breadcrumbs->push(trans('firefly.add_money_to_piggy', ['name' => $piggyBank->name]), route('piggy-banks.add-money-mobile', [$piggyBank->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'piggy-banks.remove-money-mobile', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
|
||||
$breadcrumbs->push(
|
||||
trans('firefly.remove_money_from_piggy_title', ['name' => $piggyBank->name]), route('piggy-banks.remove-money-mobile', [$piggyBank->id])
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@ -513,6 +528,16 @@ Breadcrumbs::register(
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* New user Controller
|
||||
*/
|
||||
Breadcrumbs::register(
|
||||
'new-user.index', function (BreadCrumbGenerator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('firefly.getting_started'), route('new-user.index'));
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Rules
|
||||
*/
|
||||
|
@ -148,4 +148,16 @@ class UserRepository implements UserRepositoryInterface
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param string $password
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function changePassword(User $user, string $password)
|
||||
{
|
||||
$user->password = bcrypt($password);
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,14 @@ interface UserRepositoryInterface
|
||||
*/
|
||||
public function attachRole(User $user, string $role): bool;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param string $password
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function changePassword(User $user, string $password);
|
||||
|
||||
/**
|
||||
* Returns a count of all users.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "./layout/default" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "./layout/default" %}
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -457,6 +457,7 @@ Route::group(
|
||||
Route::get('', ['uses' => 'ProfileController@index', 'as' => 'index']);
|
||||
Route::get('change-password', ['uses' => 'ProfileController@changePassword', 'as' => 'change-password']);
|
||||
Route::get('delete-account', ['uses' => 'ProfileController@deleteAccount', 'as' => 'delete-account']);
|
||||
|
||||
Route::post('delete-account', ['uses' => 'ProfileController@postDeleteAccount', 'as' => 'delete-account.post']);
|
||||
Route::post('change-password', ['uses' => 'ProfileController@postChangePassword', 'as' => 'change-password.post']);
|
||||
}
|
||||
|
@ -94,6 +94,15 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
public function emptyUser()
|
||||
{
|
||||
$user = User::find(2);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
|
@ -31,10 +31,10 @@ class NewUserControllerTest extends TestCase
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->emptyUser());
|
||||
$this->call('get', route('new-user.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,10 +42,14 @@ class NewUserControllerTest extends TestCase
|
||||
*/
|
||||
public function testSubmit()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$data = [
|
||||
'bank_name' => 'New bank',
|
||||
'bank_balance' => 100,
|
||||
];
|
||||
$this->be($this->emptyUser());
|
||||
$this->call('post', route('new-user.submit'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
@ -28,182 +29,191 @@ class PiggyBankControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::add
|
||||
* Implement testAdd().
|
||||
*/
|
||||
public function testAdd()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.add', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::addMobile
|
||||
* Implement testAddMobile().
|
||||
*/
|
||||
public function testAddMobile()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.add-money-mobile', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::create
|
||||
* Implement testCreate().
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::delete
|
||||
* Implement testDelete().
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::destroy
|
||||
* Implement testDestroy().
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$repository = $this->mock(PiggyBankRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
|
||||
$this->session(['piggy-banks.delete.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.destroy', [2]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::edit
|
||||
* Implement testEdit().
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::index
|
||||
* Implement testIndex().
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::order
|
||||
* Implement testOrder().
|
||||
*/
|
||||
public function testOrder()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.order', [1, 2]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::postAdd
|
||||
* Implement testPostAdd().
|
||||
*/
|
||||
public function testPostAdd()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$data = ['amount' => 1];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.add', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('piggy-banks.index');
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::postRemove
|
||||
* Implement testPostRemove().
|
||||
*/
|
||||
public function testPostRemove()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$data = ['amount' => 1];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.remove', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('piggy-banks.index');
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::remove
|
||||
* Implement testRemove().
|
||||
*/
|
||||
public function testRemove()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.remove', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::removeMobile
|
||||
* Implement testRemoveMobile().
|
||||
*/
|
||||
public function testRemoveMobile()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.remove-money-mobile', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::show
|
||||
* Implement testShow().
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::store
|
||||
* Implement testStore().
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['piggy-banks.create.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'name' => 'Piggy ' . rand(999, 10000),
|
||||
'targetamount' => 100,
|
||||
'account_id' => 2,
|
||||
'amount_currency_id_targetamount' => 1,
|
||||
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.store'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::update
|
||||
* Implement testUpdate().
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['piggy-banks.edit.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'name' => 'Updated Piggy ' . rand(999, 10000),
|
||||
'targetamount' => 100,
|
||||
'account_id' => 2,
|
||||
'amount_currency_id_targetamount' => 1,
|
||||
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.update', [3]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,61 +28,51 @@ class PreferencesControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::code
|
||||
* Implement testCode().
|
||||
*/
|
||||
public function testCode()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('preferences.code'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::deleteCode
|
||||
* Implement testDeleteCode().
|
||||
*/
|
||||
public function testDeleteCode()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('preferences.delete-code'));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertSessionHas('info');
|
||||
$this->assertRedirectedToRoute('preferences.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::index
|
||||
* Implement testIndex().
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::postCode
|
||||
* Implement testPostCode().
|
||||
*/
|
||||
public function testPostCode()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('preferences.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::postIndex
|
||||
* Implement testPostIndex().
|
||||
*/
|
||||
public function testPostIndex()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$data = [
|
||||
'fiscalYearStart' => '2016-01-01'
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('preferences.update'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('preferences.index');
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
@ -28,61 +29,69 @@ class ProfileControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController::changePassword
|
||||
* Implement testChangePassword().
|
||||
*/
|
||||
public function testChangePassword()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('profile.change-password'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController::deleteAccount
|
||||
* Implement testDeleteAccount().
|
||||
*/
|
||||
public function testDeleteAccount()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('profile.delete-account'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController::index
|
||||
* Implement testIndex().
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('profile.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController::postChangePassword
|
||||
* Implement testPostChangePassword().
|
||||
*/
|
||||
public function testPostChangePassword()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('changePassword');
|
||||
|
||||
$data = [
|
||||
'current_password' => 'james',
|
||||
'new_password' => 'james2',
|
||||
'new_password_confirmation' => 'james2',
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('profile.change-password.post'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController::postDeleteAccount
|
||||
* Implement testPostDeleteAccount().
|
||||
*/
|
||||
public function testPostDeleteAccount()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy');
|
||||
$data = [
|
||||
'password' => 'james',
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('profile.delete-account.post'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user