From 395c8ee8eb5903e0e6211e14025ab41a3be82a1c Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 22 May 2026 05:20:41 +0300 Subject: [PATCH] Cleanup: Remove temporary flow testing scripts --- backend/public/test_flow.php | 101 ----------------------------------- backend/test_flow.php | 88 ------------------------------ 2 files changed, 189 deletions(-) delete mode 100644 backend/public/test_flow.php delete mode 100644 backend/test_flow.php diff --git a/backend/public/test_flow.php b/backend/public/test_flow.php deleted file mode 100644 index 30aac23..0000000 --- a/backend/public/test_flow.php +++ /dev/null @@ -1,101 +0,0 @@ - $phone, - 'body' => $body, - 'id' => 'msg_' . uniqid() - ]; - - // Temporarily point gateway to a local dummy or mock so curl doesn't fail - $oldGateway = getenv('WHATSAPP_GATEWAY_URL'); - putenv('WHATSAPP_GATEWAY_URL=http://localhost:9999'); // Invalid/mock port to prevent actual gateway call or we can let it fail gracefully - - $handled = ConversationFlowEngine::processMessage($session, $msgData); - echo "Handled by Engine: " . ($handled ? "YES" : "NO") . "\n"; - - // Restore gateway - if ($oldGateway) { - putenv("WHATSAPP_GATEWAY_URL={$oldGateway}"); - } - - // Print current state in DB - $state = ConversationState::findActive($session['company_id'], $phone); - if ($state) { - echo "Current DB State: Step = '{$state['current_step']}', Context = '{$state['context_data']}'\n"; - } else { - echo "Current DB State: [No Active Flow / Finished]\n"; - } -} - -// 3. Run test cases -// Case A: Message not triggering anything -simulateIncoming($session, $testPhone, "مرحبا"); - -// Case B: Trigger keyword "اختبار" -simulateIncoming($session, $testPhone, "اختبار"); - -// Case C: Provide name "احمد" -simulateIncoming($session, $testPhone, "احمد"); - -// Case D: Provide invalid rating "10" -simulateIncoming($session, $testPhone, "10"); - -// Case E: Provide valid rating "5" -simulateIncoming($session, $testPhone, "5"); - -// Case F: Start again and test cancellation -simulateIncoming($session, $testPhone, "اختبار"); -simulateIncoming($session, $testPhone, "إلغاء"); - -echo "\n=== Mock Test Complete ===\n"; diff --git a/backend/test_flow.php b/backend/test_flow.php deleted file mode 100644 index 151f7e0..0000000 --- a/backend/test_flow.php +++ /dev/null @@ -1,88 +0,0 @@ - $phone, - 'body' => $body, - 'id' => 'msg_' . uniqid() - ]; - - $handled = ConversationFlowEngine::processMessage($session, $msgData); - echo "Handled by Engine: " . ($handled ? "YES" : "NO") . "\n"; - - // Print current state in DB - $state = ConversationState::findActive($session['company_id'], $phone); - if ($state) { - echo "Current DB State: Step = '{$state['current_step']}', Context = '{$state['context_data']}'\n"; - } else { - echo "Current DB State: [No Active Flow / Finished]\n"; - } -} - -// 3. Run test cases -// Case A: Message not triggering anything -simulateIncoming($session, $testPhone, "مرحبا"); - -// Case B: Trigger keyword "اختبار" -simulateIncoming($session, $testPhone, "اختبار"); - -// Case C: Provide name "احمد" -simulateIncoming($session, $testPhone, "احمد"); - -// Case D: Provide invalid rating "10" -simulateIncoming($session, $testPhone, "10"); - -// Case E: Provide valid rating "5" -simulateIncoming($session, $testPhone, "5"); - -// Case F: Start again and test cancellation -simulateIncoming($session, $testPhone, "اختبار"); -simulateIncoming($session, $testPhone, "إلغاء"); - -echo "\n=== Mock Test Complete ===\n";