mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 00:02:15 +00:00
added it_update_user_settings, it_update_user_avatar test
This commit is contained in:
@@ -8,7 +8,7 @@ use Laravel\Sanctum\Sanctum;
|
||||
use Storage;
|
||||
use Tests\TestCase;
|
||||
|
||||
class UserTest extends TestCase
|
||||
class AuthTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
@@ -70,24 +70,4 @@ class UserTest extends TestCase
|
||||
'password' => 'secret',
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_update_user_settings()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->patchJson('/api/user/relationships/settings', [
|
||||
'name' => 'address',
|
||||
'value' => 'Jantar',
|
||||
])->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseHas('user_settings', [
|
||||
'address' => 'Jantar',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,25 @@
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Services\SetupService;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Storage;
|
||||
use Tests\TestCase;
|
||||
|
||||
class UserAccountTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setup = app()->make(SetupService::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
@@ -31,4 +40,49 @@ class UserAccountTest extends TestCase
|
||||
|
||||
// TODO: login s novym heslom
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_update_user_settings()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->patchJson('/api/user/relationships/settings', [
|
||||
'name' => 'address',
|
||||
'value' => 'Jantar',
|
||||
])->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseHas('user_settings', [
|
||||
'address' => 'Jantar',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_update_user_avatar()
|
||||
{
|
||||
Storage::fake('local');
|
||||
|
||||
$this->setup->create_directories();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$avatar = UploadedFile::fake()
|
||||
->image('fake-image.jpg');
|
||||
|
||||
$this->patchJson('/api/user/relationships/settings', [
|
||||
'avatar' => $avatar,
|
||||
])->assertStatus(204);
|
||||
|
||||
Storage::disk('local')
|
||||
->assertExists($user->settings->avatar);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user