diff --git a/scripts/check_conversations_for_phone.php b/scripts/check_conversations_for_phone.php new file mode 100644 index 0000000..fa866b9 --- /dev/null +++ b/scripts/check_conversations_for_phone.php @@ -0,0 +1,7 @@ +fetchAll("SELECT c.id, c.message_id, c.direction, c.message_type, c.content, c.created_at, u.phone_number FROM conversations c JOIN users u ON c.user_id=u.id WHERE u.phone_number = ? ORDER BY c.created_at DESC LIMIT 5", [$phone]); +header('Content-Type: application/json'); +echo json_encode($rows, JSON_PRETTY_PRINT); diff --git a/scripts/check_graph_phone.php b/scripts/check_graph_phone.php new file mode 100644 index 0000000..31f8488 --- /dev/null +++ b/scripts/check_graph_phone.php @@ -0,0 +1,29 @@ + $url, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_TIMEOUT => 15, + CURLOPT_SSL_VERIFYPEER => true +]); +$response = curl_exec($ch); +$code = curl_getinfo($ch, CURLINFO_HTTP_CODE); +$err = curl_error($ch); +curl_close($ch); +if ($err) { + echo "cURL error: $err\n"; + exit(1); +} +echo "HTTP Code: $code\n"; +echo "Response:\n"; +echo $response . "\n"; +$decoded = json_decode($response, true); +if ($decoded && isset($decoded['error'])) { + echo "\nDetected error message: " . ($decoded['error']['message'] ?? json_encode($decoded['error'])) . "\n"; +} diff --git a/scripts/run_diagnose_cli.php b/scripts/run_diagnose_cli.php new file mode 100644 index 0000000..66cc733 --- /dev/null +++ b/scripts/run_diagnose_cli.php @@ -0,0 +1,3 @@ +getMessage() . "\n"; + echo $t->getTraceAsString() . "\n"; +} +$out = ob_get_clean(); +echo $out; \ No newline at end of file diff --git a/scripts/test_send_text.php b/scripts/test_send_text.php new file mode 100644 index 0000000..79165e4 --- /dev/null +++ b/scripts/test_send_text.php @@ -0,0 +1,12 @@ +sendTextMessage($to, $message); + echo "Response:\n"; + echo json_encode($res, JSON_PRETTY_PRINT) . "\n"; +} catch (Exception $e) { + echo "Error: " . $e->getMessage() . "\n"; +} diff --git a/tests/api_output.html b/tests/api_output.html new file mode 100644 index 0000000..8efc70f Binary files /dev/null and b/tests/api_output.html differ diff --git a/tests/api_output_after_fix.html b/tests/api_output_after_fix.html new file mode 100644 index 0000000..b5f4240 Binary files /dev/null and b/tests/api_output_after_fix.html differ diff --git a/tests/api_output_after_fix2.html b/tests/api_output_after_fix2.html new file mode 100644 index 0000000..f8801f1 Binary files /dev/null and b/tests/api_output_after_fix2.html differ diff --git a/tests/output.html b/tests/output.html new file mode 100644 index 0000000..43ee9e9 Binary files /dev/null and b/tests/output.html differ diff --git a/tests/output_after_fix.html b/tests/output_after_fix.html new file mode 100644 index 0000000..5ef683a Binary files /dev/null and b/tests/output_after_fix.html differ diff --git a/tests/output_final.html b/tests/output_final.html new file mode 100644 index 0000000..50e807f Binary files /dev/null and b/tests/output_final.html differ diff --git a/tests/service_output.html b/tests/service_output.html new file mode 100644 index 0000000..1ab7b19 Binary files /dev/null and b/tests/service_output.html differ diff --git a/tests/service_output_after_fix.html b/tests/service_output_after_fix.html new file mode 100644 index 0000000..9e2bad6 Binary files /dev/null and b/tests/service_output_after_fix.html differ diff --git a/tests/service_tests.php b/tests/service_tests.php index aa5acd3..fbc34d5 100644 --- a/tests/service_tests.php +++ b/tests/service_tests.php @@ -252,8 +252,12 @@ class ServiceTestSuite { }); $this->serviceTest("Test gestión de usuarios", function() { - $testPhone = '573168950803'; - + // Generar teléfono de prueba único para evitar colisiones + $testPhone = '573' . rand(100000000, 999999999); + + // Asegurar limpieza previa (por si quedó un registro previo con mismo número) + $this->db->execute("DELETE FROM users WHERE phone_number = :phone", ['phone' => $testPhone]); + // Crear usuario de prueba $userId = $this->db->insert('users', [ 'phone_number' => $testPhone,