Files
firefly-iii/tests/acceptance/Controllers/ProfileControllerTest.php

98 lines
2.8 KiB
PHP
Raw Normal View History

2016-11-19 20:30:30 +01:00
<?php
2016-12-06 09:16:36 +01:00
/**
* ProfileControllerTest.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
2016-12-18 17:54:11 +01:00
use FireflyIII\Repositories\User\UserRepositoryInterface;
2016-11-19 20:30:30 +01:00
/**
2016-12-10 06:54:50 +01:00
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
2016-11-19 20:30:30 +01:00
*/
class ProfileControllerTest extends TestCase
{
2016-11-20 07:24:18 +01:00
2016-11-19 20:30:30 +01:00
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
2016-11-20 08:30:25 +01:00
parent::setUp();
2016-11-19 20:30:30 +01:00
}
2016-12-07 19:53:41 +01:00
/**
* @covers \FireflyIII\Http\Controllers\ProfileController::changePassword
2016-11-19 20:30:30 +01:00
*/
public function testChangePassword()
{
2016-12-18 17:54:11 +01:00
$this->be($this->user());
$this->call('get', route('profile.change-password'));
$this->assertResponseStatus(200);
$this->see('<ol class="breadcrumb">');
2016-11-19 20:30:30 +01:00
}
/**
2016-12-07 19:53:41 +01:00
* @covers \FireflyIII\Http\Controllers\ProfileController::deleteAccount
2016-11-19 20:30:30 +01:00
*/
public function testDeleteAccount()
{
2016-12-18 17:54:11 +01:00
$this->be($this->user());
$this->call('get', route('profile.delete-account'));
$this->assertResponseStatus(200);
$this->see('<ol class="breadcrumb">');
2016-11-19 20:30:30 +01:00
}
/**
2016-12-07 19:53:41 +01:00
* @covers \FireflyIII\Http\Controllers\ProfileController::index
2016-11-19 20:30:30 +01:00
*/
public function testIndex()
{
2016-12-18 17:54:11 +01:00
$this->be($this->user());
$this->call('get', route('profile.index'));
$this->assertResponseStatus(200);
$this->see('<ol class="breadcrumb">');
2016-11-19 20:30:30 +01:00
}
/**
2016-12-07 19:53:41 +01:00
* @covers \FireflyIII\Http\Controllers\ProfileController::postChangePassword
2016-11-19 20:30:30 +01:00
*/
public function testPostChangePassword()
{
2016-12-18 17:54:11 +01:00
$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');
2016-11-19 20:30:30 +01:00
}
/**
2016-12-07 19:53:41 +01:00
* @covers \FireflyIII\Http\Controllers\ProfileController::postDeleteAccount
2016-11-19 20:30:30 +01:00
*/
public function testPostDeleteAccount()
{
2016-12-18 17:54:11 +01:00
$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');
2016-11-19 20:30:30 +01:00
}
}