mejoras
This commit is contained in:
+27
-27
@@ -279,31 +279,31 @@ class APITestSuite {
|
||||
private function testConfigurationAPIs() {
|
||||
echo "<h4>⚙️ Tests de APIs de Configuración</h4>";
|
||||
|
||||
// Test get_settings.php
|
||||
$this->apiTest("API get_settings existe", function() {
|
||||
if (!file_exists(__DIR__ . '/../api/get_settings.php')) {
|
||||
throw new Exception("get_settings.php no existe");
|
||||
// Test get_system_config.php
|
||||
$this->apiTest("API get_system_config existe", function() {
|
||||
if (!file_exists(__DIR__ . '/../api/get_system_config.php')) {
|
||||
throw new Exception("get_system_config.php no existe");
|
||||
}
|
||||
|
||||
$content = file_get_contents(__DIR__ . '/../api/get_settings.php');
|
||||
$content = file_get_contents(__DIR__ . '/../api/get_system_config.php');
|
||||
|
||||
if (strpos($content, 'requireAuthentication()') === false) {
|
||||
throw new Exception("get_settings no requiere autenticación");
|
||||
throw new Exception("get_system_config no requiere autenticación");
|
||||
}
|
||||
|
||||
return "API get_settings correcta";
|
||||
return "API get_system_config correcta";
|
||||
});
|
||||
|
||||
// Test save_settings.php
|
||||
$this->apiTest("API save_settings existe", function() {
|
||||
if (!file_exists(__DIR__ . '/../api/save_settings.php')) {
|
||||
throw new Exception("save_settings.php no existe");
|
||||
// Test save_system_config.php
|
||||
$this->apiTest("API save_system_config existe", function() {
|
||||
if (!file_exists(__DIR__ . '/../api/save_system_config.php')) {
|
||||
throw new Exception("save_system_config.php no existe");
|
||||
}
|
||||
|
||||
$content = file_get_contents(__DIR__ . '/../api/save_settings.php');
|
||||
$content = file_get_contents(__DIR__ . '/../api/save_system_config.php');
|
||||
|
||||
if (strpos($content, 'requireAuthentication()') === false) {
|
||||
throw new Exception("save_settings no requiere autenticación");
|
||||
throw new Exception("save_system_config no requiere autenticación");
|
||||
}
|
||||
|
||||
$fields = ['business_name', 'whatsapp_token', 'phone_number_id'];
|
||||
@@ -313,16 +313,16 @@ class APITestSuite {
|
||||
}
|
||||
}
|
||||
|
||||
return "API save_settings completa";
|
||||
return "API save_system_config completa";
|
||||
});
|
||||
|
||||
// Verificar tabla settings
|
||||
// Verificar tabla system_config
|
||||
$this->apiTest("Verificar tabla configuración", function() {
|
||||
$db = Database::getInstance();
|
||||
|
||||
$result = $db->fetchAll("SHOW TABLES LIKE 'settings'");
|
||||
$result = $db->fetchAll("SHOW TABLES LIKE 'system_config'");
|
||||
if (!$result || empty($result)) {
|
||||
throw new Exception("Tabla settings no existe");
|
||||
throw new Exception("Tabla system_config no existe");
|
||||
}
|
||||
|
||||
return "Tabla de configuración existe";
|
||||
@@ -344,7 +344,7 @@ class APITestSuite {
|
||||
throw new Exception("get_stats no requiere autenticación");
|
||||
}
|
||||
|
||||
$stats = ['total_users', 'messages_today', 'active_users', 'total_messages'];
|
||||
$stats = ['total_users', 'conversations_today', 'active_users', 'total_conversations'];
|
||||
foreach ($stats as $stat) {
|
||||
if (strpos($content, $stat) === false) {
|
||||
throw new Exception("Estadística '$stat' no está implementada");
|
||||
@@ -369,30 +369,30 @@ class APITestSuite {
|
||||
return "API get_chart_data correcta";
|
||||
});
|
||||
|
||||
// Test get_recent_messages.php
|
||||
$this->apiTest("API get_recent_messages existe", function() {
|
||||
if (!file_exists(__DIR__ . '/../api/get_recent_messages.php')) {
|
||||
throw new Exception("get_recent_messages.php no existe");
|
||||
// Test get_recent_conversations.php
|
||||
$this->apiTest("API get_recent_conversations existe", function() {
|
||||
if (!file_exists(__DIR__ . '/../api/get_recent_conversations.php')) {
|
||||
throw new Exception("get_recent_conversations.php no existe");
|
||||
}
|
||||
|
||||
$content = file_get_contents(__DIR__ . '/../api/get_recent_messages.php');
|
||||
$content = file_get_contents(__DIR__ . '/../api/get_recent_conversations.php');
|
||||
|
||||
if (strpos($content, 'requireAuthentication()') === false) {
|
||||
throw new Exception("get_recent_messages no requiere autenticación");
|
||||
throw new Exception("get_recent_conversations no requiere autenticación");
|
||||
}
|
||||
|
||||
if (strpos($content, 'messages') === false && strpos($content, 'conversations') === false) {
|
||||
if (strpos($content, 'conversations') === false && strpos($content, 'conversations') === false) {
|
||||
throw new Exception("No consulta mensajes");
|
||||
}
|
||||
|
||||
return "API get_recent_messages correcta";
|
||||
return "API get_recent_conversations correcta";
|
||||
});
|
||||
|
||||
// Test de integridad de datos
|
||||
$this->apiTest("Verificar tablas de analytics", function() {
|
||||
$db = Database::getInstance();
|
||||
|
||||
$tables = ['messages', 'conversations'];
|
||||
$tables = ['conversations', 'conversations'];
|
||||
foreach ($tables as $table) {
|
||||
$result = $db->fetchAll("SHOW TABLES LIKE '$table'");
|
||||
if (!$result || empty($result)) {
|
||||
|
||||
Reference in New Issue
Block a user