get data from dataabse and upload/download storage chart

This commit is contained in:
Čarodej
2021-11-30 17:32:25 +01:00
parent 751ebcb7eb
commit c7c81dda34
8 changed files with 238 additions and 64 deletions

View File

@@ -1,6 +1,7 @@
<?php
namespace Tests\Domain\Traffic;
use Illuminate\Support\Facades\DB;
use Storage;
use Tests\TestCase;
use App\Users\Models\User;
@@ -186,4 +187,28 @@ class TrafficTest extends TestCase
'download' => $document->getSize(),
]);
}
/**
* @test
*/
public function it_get_user_traffic_test()
{
$user = User::factory()
->create();
foreach (range(0, 30) as $day) {
DB::table('traffic')->insert([
'id' => Str::uuid(),
'user_id' => $user->id,
'upload' => random_int(11111111, 99999999),
'download' => random_int(11111111, 99999999),
'created_at' => now()->subDays($day),
'updated_at' => now()->subDays($day),
]);
}
$this->actingAs($user)
->get('/api/user/storage')
->assertOk();
}
}