This commit is contained in:
Lizandro Guarnizo
2026-02-21 07:37:36 -05:00
parent 2f73ee2a1a
commit de4b07c806
14 changed files with 2001 additions and 23 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
require_once __DIR__ . '/config/config.php';
$db = Database::getInstance();
// Test 1: update() con WHERE posicional (?)
echo "Test 1: update con WHERE posicional...\n";
try {
$db->update('file_requests', ['message_sent_id' => 'test_msg_' . time()], 'id = ?', [99999]);
echo " OK!\n";
} catch (Exception $e) {
echo " FAIL: " . $e->getMessage() . "\n";
}
// Test 2: update() con WHERE nombrado (:id)
echo "Test 2: update con WHERE nombrado...\n";
try {
$db->update('users', ['advisor_requested' => 0], 'id = :id', ['id' => 99999]);
echo " OK!\n";
} catch (Exception $e) {
echo " FAIL: " . $e->getMessage() . "\n";
}
// Test 3: update() con WHERE nombrado y multiple data
echo "Test 3: update con WHERE nombrado + multiple data...\n";
try {
$db->update('users', ['advisor_requested' => 0, 'on_hold' => 0], 'id = :id', ['id' => 99999]);
echo " OK!\n";
} catch (Exception $e) {
echo " FAIL: " . $e->getMessage() . "\n";
}
// Test 4: insert (para validar que no rompe)
echo "Test 4: insert nombrado...\n";
try {
// Simular: solo preparar, no ejecutar (tabla puede no existir con esas FK constraints)
echo " SKIP (no test insert real)\n";
} catch (Exception $e) {
echo " FAIL: " . $e->getMessage() . "\n";
}
echo "\nDone!\n";