added UserAccountTest

This commit is contained in:
Peter Papp
2021-03-02 17:24:13 +01:00
parent f95b3acbd2
commit 7f21755f5a
5 changed files with 41 additions and 26 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Laravel\Sanctum\Sanctum;
use Tests\TestCase;
class UserAccountTest extends TestCase
{
use DatabaseMigrations;
/**
* @test
*/
public function it_change_user_password_in_profile_settings()
{
$user = User::factory(User::class)
->create();
Sanctum::actingAs($user);
$this->postJson('/api/user/password', [
'current_password' => 'secret',
'password' => 'VerySecretPassword',
'password_confirmation' => 'VerySecretPassword',
])->assertStatus(204);
// TODO: login s novym heslom
}
}

View File

@@ -2,8 +2,6 @@
namespace Tests\Feature;
use App\Models\File;
use App\Models\Folder;
use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Sanctum\Sanctum;
@@ -73,23 +71,6 @@ class UserTest extends TestCase
])->assertStatus(200);
}
/**
* @test
*/
public function it_change_user_password_in_profile_settings()
{
$user = User::factory(User::class)
->create();
Sanctum::actingAs($user);
$this->putJson('/user/password', [
'current_password' => 'secret',
'password' => 'VerySecretPassword',
'password_confirmation' => 'VerySecretPassword',
])->assertStatus(200);
}
/**
* @test
*/