mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
record daily traffic instead of monthly
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\App\Users;
|
||||
|
||||
use Storage;
|
||||
@@ -118,7 +117,7 @@ class UserAccountTest extends TestCase
|
||||
|
||||
collect(config('vuefilemanager.avatar_sizes'))
|
||||
->each(
|
||||
fn($size) => Storage::disk('local')
|
||||
fn ($size) => Storage::disk('local')
|
||||
->assertExists("avatars/{$size['name']}-{$user->settings->getRawOriginal('avatar')}")
|
||||
);
|
||||
}
|
||||
@@ -137,7 +136,7 @@ class UserAccountTest extends TestCase
|
||||
->assertStatus(200)
|
||||
->assertExactJson([
|
||||
'data' => [
|
||||
'id' => (string)$user->id,
|
||||
'id' => (string) $user->id,
|
||||
'type' => 'user',
|
||||
'attributes' => [
|
||||
'avatar' => null,
|
||||
@@ -157,7 +156,7 @@ class UserAccountTest extends TestCase
|
||||
'relationships' => [
|
||||
'settings' => [
|
||||
'data' => [
|
||||
'id' => (string)$user->id,
|
||||
'id' => (string) $user->id,
|
||||
'type' => 'settings',
|
||||
'attributes' => [
|
||||
'avatar' => $user->settings->avatar,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Domain\Teams;
|
||||
|
||||
use Tests\TestCase;
|
||||
@@ -29,7 +28,8 @@ class TeamLimitsTest extends TestCase
|
||||
->count(5)
|
||||
->create();
|
||||
|
||||
$members->each(fn($member) => TeamFolderMember::factory()
|
||||
$members->each(
|
||||
fn ($member) => TeamFolderMember::factory()
|
||||
->create([
|
||||
'parent_id' => $user->folders[0]->id,
|
||||
'user_id' => $member->id,
|
||||
@@ -84,4 +84,4 @@ class TeamLimitsTest extends TestCase
|
||||
])
|
||||
->assertCreated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace Tests\Domain\Traffic;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Storage;
|
||||
use Tests\TestCase;
|
||||
use App\Users\Models\User;
|
||||
@@ -10,6 +9,7 @@ use Domain\Files\Models\File;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TrafficTest extends TestCase
|
||||
{
|
||||
@@ -50,7 +50,7 @@ class TrafficTest extends TestCase
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_record_current_month_and_go_to_the_next_month_and_record_it()
|
||||
public function it_record_current_day_and_go_to_the_next_day_and_record_it()
|
||||
{
|
||||
$this
|
||||
->actingAs($this->user)
|
||||
@@ -67,7 +67,7 @@ class TrafficTest extends TestCase
|
||||
'created_at' => now(),
|
||||
]);
|
||||
|
||||
$this->travel(1)->months();
|
||||
$this->travel(1)->day();
|
||||
|
||||
$secondFile = UploadedFile::fake()
|
||||
->image('fake-file-2.jpg', 1200);
|
||||
@@ -200,8 +200,8 @@ class TrafficTest extends TestCase
|
||||
DB::table('traffic')->insert([
|
||||
'id' => Str::uuid(),
|
||||
'user_id' => $user->id,
|
||||
'upload' => random_int(11111111, 99999999),
|
||||
'download' => random_int(11111111, 99999999),
|
||||
'upload' => 10000 * $day,
|
||||
'download' => 1000000 * $day,
|
||||
'created_at' => now()->subDays($day),
|
||||
'updated_at' => now()->subDays($day),
|
||||
]);
|
||||
@@ -209,6 +209,10 @@ class TrafficTest extends TestCase
|
||||
|
||||
$this->actingAs($user)
|
||||
->get('/api/user/storage')
|
||||
->assertOk();
|
||||
->assertOk()
|
||||
->assertJsonFragment([
|
||||
'download' => '465.00MB',
|
||||
'upload' => '4.65MB',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user