mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-02 05:10:59 +00:00
* refactor: stabilize model identities for domain migration * refactor: extract module platform context * refactor: assign models to domain contexts * refactor: extract ai platform context * refactor: extract storage platform context * refactor: extract mail platform context * refactor: extract pdf platform context * refactor: extract operations platform context * refactor: move installation into operations platform * refactor: extract money domain context * refactor: extract taxation domain context * refactor: extract catalog domain context * refactor: extract metadata domain context * refactor: extract reporting domain context * refactor: extract purchases domain context * refactor: extract receivables domain context * refactor: extract accounts domain context * refactor: complete reporting statement boundary * refactor: extract contacts domain context * refactor: extract sales domain context * refactor: remove legacy application layers * fix: migrate legacy bouncer role identities
66 lines
1.6 KiB
PHP
66 lines
1.6 KiB
PHP
<?php
|
|
|
|
use App\Domains\Accounts\Models\User;
|
|
use App\Platform\Storage\Models\FileDisk;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
use Laravel\Sanctum\Sanctum;
|
|
|
|
use function Pest\Laravel\getJson;
|
|
use function Pest\Laravel\postJson;
|
|
use function Pest\Laravel\putJson;
|
|
|
|
beforeEach(function () {
|
|
Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]);
|
|
Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]);
|
|
|
|
$user = User::find(1);
|
|
$this->withHeaders([
|
|
'company' => $user->companies()->first()->id,
|
|
]);
|
|
Sanctum::actingAs(
|
|
$user,
|
|
['*']
|
|
);
|
|
});
|
|
|
|
test('get file disks', function () {
|
|
$response = getJson('/api/v1/disks');
|
|
|
|
$response->assertOk();
|
|
});
|
|
|
|
test('create file disk', function () {
|
|
$disk = FileDisk::factory()->raw();
|
|
|
|
$response = postJson('/api/v1/disks', $disk);
|
|
|
|
$disk['credentials'] = json_encode($disk['credentials']);
|
|
$this->assertDatabaseHas('file_disks', $disk);
|
|
});
|
|
|
|
test('update file disk', function () {
|
|
$disk = FileDisk::factory()->create();
|
|
|
|
$disk2 = FileDisk::factory()->raw();
|
|
|
|
$response = putJson("/api/v1/disks/{$disk->id}", $disk2)->assertStatus(200);
|
|
|
|
$disk2['credentials'] = json_encode($disk2['credentials']);
|
|
|
|
$this->assertDatabaseHas('file_disks', $disk2);
|
|
});
|
|
|
|
test('get disk', function () {
|
|
$disk = FileDisk::factory()->create();
|
|
|
|
$response = getJson("/api/v1/disks/{$disk->driver}");
|
|
|
|
$response->assertStatus(200);
|
|
});
|
|
|
|
test('get drivers', function () {
|
|
$response = getJson('/api/v1/disk/drivers');
|
|
|
|
$response->assertStatus(200);
|
|
});
|