add all controllers logic
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\System;
|
||||
|
||||
use App\Services\System\CleanupSchedulerService;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CleanupSchedulerServiceTest extends TestCase
|
||||
{
|
||||
public function test_should_run_when_no_cache(): void
|
||||
{
|
||||
Cache::forget('last_cleanup_run');
|
||||
|
||||
$service = new CleanupSchedulerService();
|
||||
$this->assertTrue($service->shouldRun('last_cleanup_run', 2));
|
||||
}
|
||||
|
||||
public function test_mark_run_sets_cache(): void
|
||||
{
|
||||
$service = new CleanupSchedulerService();
|
||||
$service->markRun('last_cleanup_run');
|
||||
|
||||
$this->assertNotNull(Cache::get('last_cleanup_run'));
|
||||
}
|
||||
|
||||
public function test_run_unverified_cleanup_calls_artisan(): void
|
||||
{
|
||||
Artisan::shouldReceive('call')->once()->with('users:delete-unverified');
|
||||
|
||||
$service = new CleanupSchedulerService();
|
||||
$service->runUnverifiedCleanup();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\System;
|
||||
|
||||
use App\Services\System\HealthCheckService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class HealthCheckServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_check_returns_payload(): void
|
||||
{
|
||||
$service = app(HealthCheckService::class);
|
||||
$payload = $service->check();
|
||||
|
||||
$this->assertArrayHasKey('ok', $payload);
|
||||
$this->assertArrayHasKey('paths', $payload);
|
||||
$this->assertArrayHasKey('database', $payload);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user