mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\User;
|
|
use Tests\TestCase;
|
|
use App\Role;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class SettingsTest extends TestCase
|
|
{
|
|
/** @var \App\User */
|
|
protected $user;
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->user = factory(User::class)->create();
|
|
}
|
|
|
|
/** @test */
|
|
public function update_profile_info()
|
|
{
|
|
$this->actingAs($this->user)
|
|
->patchJson('/api/settings/profile', [
|
|
'name' => 'Test User',
|
|
'email' => 'test@test.app',
|
|
])
|
|
->assertSuccessful()
|
|
->assertJsonStructure(['id', 'name', 'email']);
|
|
|
|
$this->assertDatabaseHas('users', [
|
|
'id' => $this->user->id,
|
|
'name' => 'Test User',
|
|
'email' => 'test@test.app',
|
|
]);
|
|
}
|
|
|
|
/** @test */
|
|
public function update_password()
|
|
{
|
|
$this->actingAs($this->user)
|
|
->patchJson('/api/settings/password', [
|
|
'password' => 'updated',
|
|
'password_confirmation' => 'updated',
|
|
])
|
|
->assertSuccessful();
|
|
|
|
$this->assertTrue(Hash::check('updated', $this->user->password));
|
|
}
|
|
|
|
}
|