43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?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";
|