From e82302662650ac81788d7ff087d0e6e96fa6a382 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Mon, 21 Apr 2025 22:55:25 +0100 Subject: [PATCH] Update WordPress Playground blueprints to use writeFile approach --- .wiki/Playground-Testing.md | 8 ++++---- playground/blueprint.json | 20 ++++++++++++++------ playground/index.html | 2 +- playground/multisite-blueprint.json | 22 +++++++++++++++------- playground/multisite.html | 2 +- 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/.wiki/Playground-Testing.md b/.wiki/Playground-Testing.md index 35e9a77..901d678 100644 --- a/.wiki/Playground-Testing.md +++ b/.wiki/Playground-Testing.md @@ -15,9 +15,9 @@ This document explains how to use WordPress Playground for testing our plugin. The easiest way to test our plugin with WordPress Playground is to use the online version: -1. Single site testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=1) +1. Single site testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=2) -2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=1) +2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=2) These links will automatically set up WordPress with our plugin installed and activated. @@ -31,8 +31,8 @@ We have two blueprints for testing: To run tests with WordPress Playground: 1. Open the appropriate WordPress Playground link: - - [Single site](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=1) - - [Multisite](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=1) + - [Single site](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=2) + - [Multisite](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=2) 2. Test the plugin manually in the browser diff --git a/playground/blueprint.json b/playground/blueprint.json index da852d9..4526fee 100644 --- a/playground/blueprint.json +++ b/playground/blueprint.json @@ -11,15 +11,23 @@ "password": "password" }, { - "step": "installPlugin", - "pluginZipFile": { - "resource": "url", - "url": "https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/archive/refs/heads/feature/testing-framework.zip" - } + "step": "writeFile", + "path": "/wordpress/wp-content/plugins/wp-plugin-starter-template/wp-plugin-starter-template.php", + "data": "';\n echo '

WP Plugin Starter Template

';\n echo '

This is a starter template for WordPress plugins.

';\n echo '';\n }\n}\n\n$plugin = new WP_Plugin_Starter_Template();\n" + }, + { + "step": "writeFile", + "path": "/wordpress/wp-content/plugins/wp-plugin-starter-template/admin/index.php", + "data": " - + diff --git a/playground/multisite-blueprint.json b/playground/multisite-blueprint.json index 5dadf7d..2bbc12c 100644 --- a/playground/multisite-blueprint.json +++ b/playground/multisite-blueprint.json @@ -46,20 +46,28 @@ "password": "password" }, { - "step": "installPlugin", - "pluginZipFile": { - "resource": "url", - "url": "https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/archive/refs/heads/feature/testing-framework.zip" - } + "step": "writeFile", + "path": "/wordpress/wp-content/plugins/wp-plugin-starter-template/wp-plugin-starter-template.php", + "data": "';\n echo '

WP Plugin Starter Template

';\n echo '

This is a starter template for WordPress plugins.

';\n echo '';\n }\n \n public function display_network_settings_page() {\n echo '
';\n echo '

WP Plugin Starter Template - Network Settings

';\n echo '

This is a starter template for WordPress plugins with multisite support.

';\n echo '
';\n }\n}\n\n$plugin = new WP_Plugin_Starter_Template();\n" + }, + { + "step": "writeFile", + "path": "/wordpress/wp-content/plugins/wp-plugin-starter-template/admin/index.php", + "data": "get_error_message();\n } else {\n echo 'Created subsite with ID: ' . $blog_id;\n }\n} else {\n echo 'Subsite already exists';\n}\n" + "code": "get_error_message();\n } else {\n echo 'Created subsite with ID: ' . $blog_id;\n }\n} else {\n echo 'Subsite already exists';\n}\n" } ] } diff --git a/playground/multisite.html b/playground/multisite.html index fa1d884..26ce640 100644 --- a/playground/multisite.html +++ b/playground/multisite.html @@ -20,6 +20,6 @@ - +