Yacht Booking System - Test Script'; // 1. Check if plugin file exists $plugin_file = __DIR__ . '/wp-content/plugins/yacht-booking-system/yacht-booking-system.php'; echo '

1. Plugin File Check

'; if (file_exists($plugin_file)) { echo '✅ Plugin file exists: ' . $plugin_file . '
'; } else { echo '❌ Plugin file NOT found: ' . $plugin_file . '
'; die(); } // 2. Check if plugin is active echo '

2. Plugin Activation Status

'; $plugin_slug = 'yacht-booking-system/yacht-booking-system.php'; if (is_plugin_active($plugin_slug)) { echo '✅ Plugin is ACTIVE
'; } else { echo '⚠️ Plugin is NOT active. Attempting to activate...
'; // Try to activate $result = activate_plugin($plugin_slug); if (is_wp_error($result)) { echo '❌ Activation failed: ' . $result->get_error_message() . '
'; } else { echo '✅ Plugin activated successfully!
'; } } // 3. Check if custom table was created echo '

3. Database Table Check

'; global $wpdb; $table_name = $wpdb->prefix . 'yacht_availability'; $table_exists = $wpdb->get_var("SHOW TABLES LIKE '$table_name'") === $table_name; if ($table_exists) { echo '✅ Custom table exists: ' . $table_name . '
'; // Show table structure $columns = $wpdb->get_results("DESCRIBE $table_name"); echo '
Table structure
';
    print_r($columns);
    echo '
'; } else { echo '❌ Custom table NOT found: ' . $table_name . '
'; } // 4. Check if CPTs are registered echo '

4. Custom Post Types Check

'; if (post_type_exists('yacht')) { echo '✅ "yacht" post type is registered
'; } else { echo '❌ "yacht" post type NOT registered
'; } if (post_type_exists('yacht_booking')) { echo '✅ "yacht_booking" post type is registered
'; } else { echo '❌ "yacht_booking" post type NOT registered
'; } // 5. Check plugin options echo '

5. Plugin Options Check

'; $version = get_option('yacht_booking_version'); if ($version) { echo '✅ Plugin version: ' . $version . '
'; } else { echo '⚠️ Plugin version option not set
'; } $installed_at = get_option('yacht_booking_installed_at'); if ($installed_at) { echo '✅ Installed at: ' . $installed_at . '
'; } else { echo '⚠️ Installation date not set
'; } // 6. Check custom capabilities echo '

6. Custom Capabilities Check

'; $admin = get_role('administrator'); if ($admin) { $caps = array( 'yacht_booking_manage_yachts', 'yacht_booking_manage_bookings', 'yacht_booking_manage_settings', ); foreach ($caps as $cap) { if ($admin->has_cap($cap)) { echo '✅ Capability exists: ' . $cap . '
'; } else { echo '❌ Capability NOT found: ' . $cap . '
'; } } } // 7. Test REST API endpoints echo '

7. REST API Endpoints Check

'; $rest_server = rest_get_server(); $namespaces = $rest_server->get_namespaces(); if (in_array('yacht-booking/v1', $namespaces)) { echo '✅ REST API namespace registered: yacht-booking/v1
'; // List all routes $routes = $rest_server->get_routes('yacht-booking/v1'); echo '
Available routes (' . count($routes) . ')
'; } else { echo '❌ REST API namespace NOT registered
'; } // 8. Check if admin menu exists echo '

8. Admin Menu Check

'; global $menu, $submenu; $found = false; foreach ($menu as $item) { if ($item[2] === 'yacht-bookings') { echo '✅ Admin menu item found: "' . $item[0] . '"
'; $found = true; break; } } if (!$found) { echo '⚠️ Admin menu item NOT found (may be admin-only)
'; } // 9. Test creating a test yacht echo '

9. Test Yacht Creation

'; $test_yacht_id = wp_insert_post(array( 'post_type' => 'yacht', 'post_title' => 'Test Yacht - ' . time(), 'post_content' => 'This is a test yacht for verification', 'post_status' => 'publish', )); if ($test_yacht_id && !is_wp_error($test_yacht_id)) { echo '✅ Test yacht created successfully (ID: ' . $test_yacht_id . ')
'; // Add meta update_post_meta($test_yacht_id, '_yacht_capacity', 8); update_post_meta($test_yacht_id, '_yacht_price_per_day', 1500); echo '✅ Meta data added (capacity: 8, price: 1500)
'; // Clean up wp_delete_post($test_yacht_id, true); echo '✅ Test yacht deleted (cleanup)
'; } else { echo '❌ Failed to create test yacht
'; } echo '
'; echo '

✅ Test Complete!

'; echo '

Next steps:

'; echo '';