Simplify WordPress Playground blueprints to minimal configuration
This commit is contained in:
@@ -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=2)
|
||||
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=3)
|
||||
|
||||
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)
|
||||
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=3)
|
||||
|
||||
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=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)
|
||||
- [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=3)
|
||||
- [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=3)
|
||||
|
||||
2. Test the plugin manually in the browser
|
||||
|
||||
|
||||
@@ -1,33 +1,10 @@
|
||||
{
|
||||
"landingPage": "/wp-admin/",
|
||||
"preferredVersions": {
|
||||
"php": "8.0",
|
||||
"wp": "latest"
|
||||
},
|
||||
"steps": [
|
||||
{
|
||||
"step": "login",
|
||||
"username": "admin",
|
||||
"password": "password"
|
||||
},
|
||||
{
|
||||
"step": "writeFile",
|
||||
"path": "/wordpress/wp-content/plugins/wp-plugin-starter-template/wp-plugin-starter-template.php",
|
||||
"data": "<?php\n/**\n * Plugin Name: WP Plugin Starter Template\n * Description: A starter template for WordPress plugins.\n * Version: 0.1.0\n * Author: WP All Stars\n * License: GPL v2 or later\n */\n\nif (!defined('ABSPATH')) {\n exit;\n}\n\nclass WP_Plugin_Starter_Template {\n public function __construct() {\n add_action('admin_menu', array($this, 'add_admin_menu'));\n }\n \n public function add_admin_menu() {\n add_options_page(\n 'WP Plugin Starter Template',\n 'WP Plugin Starter Template',\n 'manage_options',\n 'wp-plugin-starter-template',\n array($this, 'display_settings_page')\n );\n }\n \n public function display_settings_page() {\n echo '<div class=\"wrap\">';\n echo '<h1>WP Plugin Starter Template</h1>';\n echo '<p>This is a starter template for WordPress plugins.</p>';\n echo '</div>';\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": "<?php // Silence is golden"
|
||||
},
|
||||
{
|
||||
"step": "writeFile",
|
||||
"path": "/wordpress/wp-content/plugins/wp-plugin-starter-template/includes/index.php",
|
||||
"data": "<?php // Silence is golden"
|
||||
},
|
||||
{
|
||||
"step": "activatePlugin",
|
||||
"pluginSlug": "wp-plugin-starter-template"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="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"></iframe>
|
||||
<iframe src="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=3"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
{
|
||||
"landingPage": "/wp-admin/network/",
|
||||
"preferredVersions": {
|
||||
"php": "8.0",
|
||||
"wp": "latest"
|
||||
},
|
||||
"landingPage": "/wp-admin/",
|
||||
"steps": [
|
||||
{
|
||||
"step": "defineWpConfig",
|
||||
@@ -44,30 +40,6 @@
|
||||
"step": "login",
|
||||
"username": "admin",
|
||||
"password": "password"
|
||||
},
|
||||
{
|
||||
"step": "writeFile",
|
||||
"path": "/wordpress/wp-content/plugins/wp-plugin-starter-template/wp-plugin-starter-template.php",
|
||||
"data": "<?php\n/**\n * Plugin Name: WP Plugin Starter Template\n * Description: A starter template for WordPress plugins.\n * Version: 0.1.0\n * Author: WP All Stars\n * License: GPL v2 or later\n */\n\nif (!defined('ABSPATH')) {\n exit;\n}\n\nclass WP_Plugin_Starter_Template {\n public function __construct() {\n add_action('admin_menu', array($this, 'add_admin_menu'));\n add_action('network_admin_menu', array($this, 'add_network_admin_menu'));\n }\n \n public function add_admin_menu() {\n add_options_page(\n 'WP Plugin Starter Template',\n 'WP Plugin Starter Template',\n 'manage_options',\n 'wp-plugin-starter-template',\n array($this, 'display_settings_page')\n );\n }\n \n public function add_network_admin_menu() {\n add_submenu_page(\n 'settings.php',\n 'WP Plugin Starter Template',\n 'WP Plugin Starter Template',\n 'manage_network_options',\n 'wp-plugin-starter-template',\n array($this, 'display_network_settings_page')\n );\n }\n \n public function display_settings_page() {\n echo '<div class=\"wrap\">';\n echo '<h1>WP Plugin Starter Template</h1>';\n echo '<p>This is a starter template for WordPress plugins.</p>';\n echo '</div>';\n }\n \n public function display_network_settings_page() {\n echo '<div class=\"wrap\">';\n echo '<h1>WP Plugin Starter Template - Network Settings</h1>';\n echo '<p>This is a starter template for WordPress plugins with multisite support.</p>';\n echo '</div>';\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": "<?php // Silence is golden"
|
||||
},
|
||||
{
|
||||
"step": "writeFile",
|
||||
"path": "/wordpress/wp-content/plugins/wp-plugin-starter-template/includes/index.php",
|
||||
"data": "<?php // Silence is golden"
|
||||
},
|
||||
{
|
||||
"step": "activatePlugin",
|
||||
"pluginSlug": "wp-plugin-starter-template",
|
||||
"networkWide": true
|
||||
},
|
||||
{
|
||||
"step": "runPHP",
|
||||
"code": "<?php\n// Create a test subsite\n$domain = 'localhost';\n$path = '/testsite/';\n$title = 'Test Subsite';\n$user_id = 1;\n\nrequire_once('/wordpress/wp-load.php');\n\nif (!function_exists('get_site_by_path')) {\n require_once('/wordpress/wp-includes/ms-blogs.php');\n}\n\nif (!get_site_by_path($domain, $path)) {\n $blog_id = wpmu_create_blog($domain, $path, $title, $user_id);\n if (is_wp_error($blog_id)) {\n echo 'Error creating subsite: ' . $blog_id->get_error_message();\n } else {\n echo 'Created subsite with ID: ' . $blog_id;\n }\n} else {\n echo 'Subsite already exists';\n}\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="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"></iframe>
|
||||
<iframe src="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=3"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user