mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-17 01:42:19 +00:00
Expanded test coverage.
This commit is contained in:
@@ -7,14 +7,12 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Tests\Feature\Controllers\Admin;
|
||||
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use Illuminate\Support\Collection;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -60,14 +58,43 @@ class UserControllerTest extends TestCase
|
||||
public function testShow()
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('getUserData')->andReturn([]);
|
||||
$repository->shouldReceive('getUserData')->andReturn(
|
||||
[
|
||||
'export_jobs_success' => 0,
|
||||
'import_jobs_success' => 0,
|
||||
'attachments_size' => 0,
|
||||
]
|
||||
);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('admin.users.edit', [1]));
|
||||
$response = $this->get(route('admin.users.show', [1]));
|
||||
$response->assertStatus(200);
|
||||
// has bread crumb
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Admin\UserController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('changePassword')->once();
|
||||
$repository->shouldReceive('changeStatus')->once();
|
||||
$data = [
|
||||
'id' => 1,
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'james',
|
||||
'password_confirmation' => 'james',
|
||||
'blocked_code' => 'blocked',
|
||||
'blocked' => 1,
|
||||
];
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('admin.users.update', ['1']), $data);
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('success');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user