*/ private static array $doctors = []; /** * Mock services data * * @var array */ private static array $services = []; /** * Mock appointments data * * @var array */ private static array $appointments = []; /** * Mock plugin active status * * @var bool */ private static bool $pluginActive = true; /** * Reset all mock data * * @return void * @since 1.0.0 */ public static function reset(): void { self::$doctors = []; self::$services = []; self::$appointments = []; self::$pluginActive = true; } /** * Check if KiviCare plugin is active * * @return bool * @since 1.0.0 */ public static function isPluginActive(): bool { return self::$pluginActive; } /** * Set plugin active status for testing * * @param bool $active * @return void * @since 1.0.0 */ public static function setPluginActive(bool $active): void { self::$pluginActive = $active; } /** * Get mock doctor data * * @param int|null $doctorId * @return array * @since 1.0.0 */ public static function getDoctors(?int $doctorId = null): array { if ($doctorId !== null) { return self::$doctors[$doctorId] ?? []; } return self::$doctors; } /** * Add mock doctor * * @param int $doctorId * @param array $data * @return void * @since 1.0.0 */ public static function addMockDoctor(int $doctorId, array $data = []): void { $defaultData = [ 'id' => $doctorId, 'display_name' => "Doctor {$doctorId}", 'user_email' => "doctor{$doctorId}@example.com", 'specialty' => 'General Medicine', 'status' => 1, ]; self::$doctors[$doctorId] = array_merge($defaultData, $data); } /** * Get mock service data * * @param int|null $serviceId * @return array * @since 1.0.0 */ public static function getServices(?int $serviceId = null): array { if ($serviceId !== null) { return self::$services[$serviceId] ?? []; } return self::$services; } /** * Add mock service * * @param int $serviceId * @param array $data * @return void * @since 1.0.0 */ public static function addMockService(int $serviceId, array $data = []): void { $defaultData = [ 'id' => $serviceId, 'name' => "Service {$serviceId}", 'type' => 'consultation', 'price' => '50.00', 'duration' => 30, 'status' => 1, ]; self::$services[$serviceId] = array_merge($defaultData, $data); } /** * Get mock appointment data * * @param int|null $appointmentId * @return array * @since 1.0.0 */ public static function getAppointments(?int $appointmentId = null): array { if ($appointmentId !== null) { return self::$appointments[$appointmentId] ?? []; } return self::$appointments; } /** * Add mock appointment * * @param int $appointmentId * @param array $data * @return void * @since 1.0.0 */ public static function addMockAppointment(int $appointmentId, array $data = []): void { $defaultData = [ 'id' => $appointmentId, 'doctor_id' => 1, 'service_id' => 1, 'patient_id' => 1, 'appointment_start_date' => date('Y-m-d'), 'appointment_start_time' => '09:00:00', 'status' => 1, ]; self::$appointments[$appointmentId] = array_merge($defaultData, $data); } /** * Mock get doctor services relationship * * @param int $doctorId * @return array * @since 1.0.0 */ public static function getDoctorServices(int $doctorId): array { $doctorServices = []; foreach (self::$services as $serviceId => $service) { // Mock: all doctors provide all services by default $doctorServices[] = $serviceId; } return $doctorServices; } /** * Mock check if doctor provides service * * @param int $doctorId * @param int $serviceId * @return bool * @since 1.0.0 */ public static function doctorProvidesService(int $doctorId, int $serviceId): bool { return isset(self::$doctors[$doctorId]) && isset(self::$services[$serviceId]); } /** * Mock appointment form HTML structure * * @return string * @since 1.0.0 */ public static function getAppointmentFormHtml(): string { $html = '
'; // Doctor selection $html .= '
'; foreach (self::$doctors as $doctor) { $html .= sprintf( '
%s
', $doctor['id'], $doctor['display_name'] ); } $html .= '
'; // Service selection $html .= '
'; foreach (self::$services as $service) { $html .= sprintf( '
%s
', $service['id'], $service['name'] ); } $html .= '
'; // Combined options $html .= '
'; foreach (self::$doctors as $doctor) { foreach (self::$services as $service) { $html .= sprintf( '
%s - %s
', $doctor['id'], $service['id'], $doctor['display_name'], $service['name'] ); } } $html .= '
'; $html .= '
'; return $html; } /** * Mock KiviCare database table names * * @return array * @since 1.0.0 */ public static function getTableNames(): array { return [ 'appointments' => 'kc_appointments', 'doctors' => 'kc_doctors', 'services' => 'kc_services', 'patients' => 'kc_patients', 'clinics' => 'kc_clinics', ]; } /** * Mock KiviCare plugin version * * @return string * @since 1.0.0 */ public static function getPluginVersion(): string { return '3.0.0'; } /** * Mock KiviCare settings * * @param string|null $key * @return mixed * @since 1.0.0 */ public static function getSettings(?string $key = null): mixed { $settings = [ 'appointment_time_format' => '12', 'appointment_date_format' => 'Y-m-d', 'appointment_slot_duration' => 30, 'booking_form_enabled' => true, 'patient_registration_enabled' => true, ]; return $key ? ($settings[$key] ?? null) : $settings; } /** * Mock KiviCare appointment statuses * * @return array * @since 1.0.0 */ public static function getAppointmentStatuses(): array { return [ 1 => 'Booked', 2 => 'Check In', 3 => 'Check Out', 4 => 'Cancelled', ]; } /** * Setup default mock data for testing * * @return void * @since 1.0.0 */ public static function setupDefaultMockData(): void { // Add mock doctors self::addMockDoctor(1, ['display_name' => 'Dr. Smith', 'specialty' => 'Cardiology']); self::addMockDoctor(2, ['display_name' => 'Dr. Johnson', 'specialty' => 'Dermatology']); self::addMockDoctor(3, ['display_name' => 'Dr. Williams', 'specialty' => 'Orthopedics']); // Add mock services self::addMockService(1, ['name' => 'General Consultation', 'duration' => 30]); self::addMockService(2, ['name' => 'Specialist Consultation', 'duration' => 45]); self::addMockService(3, ['name' => 'Follow-up', 'duration' => 15]); // Add mock appointments self::addMockAppointment(1, ['doctor_id' => 1, 'service_id' => 1]); self::addMockAppointment(2, ['doctor_id' => 2, 'service_id' => 2]); self::addMockAppointment(3, ['doctor_id' => 1, 'service_id' => 3]); } }