<?php
/**
 * Test Wishlist Count API
 * Simple test to verify the wishlist count functionality
 */

session_start();

// Simulate logged in user for testing
if (!isset($_SESSION['user_id'])) {
    $_SESSION['user_id'] = 1; // Test user ID
    echo "⚠️ Test mode: Using user_id = 1/n/n";
}

echo "Testing Wishlist Count API/n";
echo "==========================/n/n";

// Test 1: Get count
echo "Test 1: Getting wishlist count.../n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/backend/api/wishlist/count.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIE, session_name() . '=' . session_id());
$response = curl_exec($ch);
curl_close($ch);

echo "Response: " . $response . "/n/n";

$data = json_decode($response, true);
if ($data && isset($data['count'])) {
    echo "✓ Count retrieved successfully: " . $data['count'] . " items/n";
} else {
    echo "✗ Failed to get count/n";
}

echo "/n==========================/n";
echo "Test completed!/n";
