{
  "$schema": "https://playground.wordpress.net/blueprint-schema.json",
  "preferredVersions": {
    "php": "8.2",
    "wp": "6.7"
  },
  "landingPage": "/wp-admin/plugins.php",
  "steps": [
    {
      "step": "login",
      "username": "admin"
    },
    {
      "step": "installPlugin",
      "pluginData": {
        "resource": "wordpress.org/plugins",
        "slug": "rb-post-views-widget"
      },
      "options": {
        "activate": true
      }
    },
    {
      "step": "mkdir",
      "path": "/wp-content/uploads"
    },
    {
      "step": "runPHP",
      "code": "<?php\n// Create multiple posts with simulated view counts for testing.\n\nfunction create_post_with_views($title, $content, $views) {\n    $post_id = wp_insert_post([\n        'post_title'   => $title,\n        'post_content' => $content,\n        'post_status'  => 'publish',\n        'post_type'    => 'post'\n    ]);\n\n    if ($post_id) {\n        update_post_meta($post_id, 'rbpvw_count', $views);\n    }\n}\n\n// Create sample posts\ncreate_post_with_views('Most Viewed Post', 'This post should appear at the top.', 150);\ncreate_post_with_views('Medium Views Post', 'This post has a moderate number of views.', 70);\ncreate_post_with_views('Low Views Post', 'This post has fewer views.', 20);\ncreate_post_with_views('New Post (0 views)', 'This post has zero views.', 0);\n\n// Done\n"
    }
  ]
}
