false]); } /** * 비활성화 시 로그가 데이터베이스에 저장되지 않는지 확인 */ public function test_disabled_log_does_not_save_to_database(): void { Log::channel('activity')->info('test.action', [ 'log_type' => ActivityLogType::Admin, 'description_key' => 'test.description', ]); $this->assertDatabaseCount('activity_logs', 0); } /** * 비활성화 시 모든 필드가 전달되어도 아무것도 저장되지 않는지 확인 */ public function test_disabled_log_ignores_all_fields(): void { $user = User::factory()->create(); Log::channel('activity')->info('test.action', [ 'log_type' => ActivityLogType::Admin, 'description_key' => 'test.description', 'loggable' => $user, 'properties' => ['key' => 'value'], 'user_id' => $user->id, 'ip_address' => '127.0.0.1', 'user_agent' => 'Test Agent', ]); $this->assertDatabaseCount('activity_logs', 0); } /** * 비활성화 → 활성화 토글이 정상 동작하는지 확인 */ public function test_enabling_after_disabled_resumes_logging(): void { Log::channel('activity')->info('disabled.action', [ 'log_type' => ActivityLogType::Admin, ]); $this->assertDatabaseCount('activity_logs', 0); config(['activity_log.enabled' => true]); Log::channel('activity')->info('enabled.action', [ 'log_type' => ActivityLogType::Admin, ]); $this->assertDatabaseHas('activity_logs', ['action' => 'enabled.action']); } }