mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
67 lines
1.7 KiB
PHP
67 lines
1.7 KiB
PHP
<?php
|
|
namespace Tests\Domain\Admin;
|
|
|
|
use Tests\TestCase;
|
|
use App\Users\Models\User;
|
|
use Domain\Files\Models\File;
|
|
|
|
class DashboardTest extends TestCase
|
|
{
|
|
/**
|
|
* @test
|
|
*/
|
|
public function it_get_dashboard_data()
|
|
{
|
|
$user = User::factory()
|
|
->create(['role' => 'admin']);
|
|
|
|
File::factory()
|
|
->count(2)
|
|
->create(['filesize' => 1000000]);
|
|
|
|
$this
|
|
->actingAs($user)
|
|
->getJson('/api/admin/dashboard')
|
|
->assertStatus(200)
|
|
->assertJsonFragment([
|
|
'app' => [
|
|
'shouldUpgradeTranslations' => true,
|
|
'earnings' => '$0.00',
|
|
'isRunningCron' => false,
|
|
'license' => 'extended',
|
|
'version' => config('vuefilemanager.version'),
|
|
],
|
|
'users' => [
|
|
'total' => 1,
|
|
'usersPremiumTotal' => 0,
|
|
],
|
|
'used' => '2.00MB',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function it_get_new_users_for_dashboard()
|
|
{
|
|
$users = User::factory()
|
|
->hasSettings()
|
|
->count(3)
|
|
->create(['role' => 'user']);
|
|
|
|
$admin = User::factory()
|
|
->hasSettings()
|
|
->create(['role' => 'admin']);
|
|
|
|
$users->each(
|
|
fn ($user) => $this
|
|
->actingAs($admin)
|
|
->getJson('/api/admin/dashboard/newbies')
|
|
->assertStatus(200)
|
|
->assertJsonFragment([
|
|
'id' => $user->id,
|
|
])
|
|
);
|
|
}
|
|
}
|