mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 20:44:13 +00:00
5df307a165
updated seeder to be informative fix seeder error on test
55 lines
1.3 KiB
PHP
55 lines
1.3 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();
|
|
$this->user->attachRole(Role::Where('name','member')->first());
|
|
}
|
|
|
|
/** @test */
|
|
public function update_profile_info()
|
|
{
|
|
$response = $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));
|
|
}
|
|
|
|
}
|